parent
812c3b5e7c
commit
c91391e0bc
|
@ -1,6 +1,5 @@
|
|||
var H5P = H5P || {};
|
||||
importScripts('/wp-content/plugins/h5p/h5p-php-library/js/h5p-version.js');
|
||||
importScripts('/wp-content/plugins/h5p/h5p-php-library/js/h5p-content-upgrade-process.js');
|
||||
importScripts('h5p-version.js', 'h5p-content-upgrade-process.js');
|
||||
|
||||
var libraryLoadedCallback;
|
||||
|
||||
|
@ -61,16 +60,3 @@ onmessage = function (event) {
|
|||
messageHandlers[event.data.action].call(this, event.data);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// if (library.upgradesScript) {
|
||||
// self.loadScript(library.upgradesScript, function (err) {
|
||||
// if (err) {
|
||||
// err = info.errorScript.replace('%lib', name + ' ' + version);
|
||||
// }
|
||||
// next(err, library);
|
||||
// });
|
||||
// }
|
||||
// else {
|
||||
// next(null, library);
|
||||
// }
|
||||
|
|
|
@ -98,8 +98,8 @@ self.io = 0;
|
|||
start();
|
||||
}
|
||||
else {
|
||||
// No workers, do the job our self
|
||||
self.loadScript('/wp-content/plugins/h5p/h5p-php-library/js/h5p-content-upgrade-process.js', start);
|
||||
// No workers, do the job ourselves
|
||||
self.loadScript(info.scriptBaseUrl + '/h5p-content-upgrade-process.js' + info.buster, start);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ self.io = 0;
|
|||
};
|
||||
|
||||
for (var i = 0; i < numWorkers; i++) {
|
||||
self.workers[i] = new Worker('/wp-content/plugins/h5p/h5p-php-library/js/h5p-content-upgrade-worker.js');
|
||||
self.workers[i] = new Worker(info.scriptBaseUrl + '/h5p-content-upgrade-worker.js' + info.buster);
|
||||
self.workers[i].onmessage = function (event) {
|
||||
if (event.data.action !== undefined && messageHandlers[event.data.action]) {
|
||||
messageHandlers[event.data.action].call(this, event.data);
|
||||
|
@ -158,6 +158,7 @@ self.io = 0;
|
|||
ContentUpgrade.prototype.nextBatch = function (outData) {
|
||||
var self = this;
|
||||
|
||||
// Track time spent on IO
|
||||
var start = new Date().getTime();
|
||||
$.post(info.infoUrl, outData, function (inData) {
|
||||
self.io += new Date().getTime() - start;
|
||||
|
@ -167,8 +168,10 @@ self.io += new Date().getTime() - start;
|
|||
}
|
||||
if (inData.left === 0) {
|
||||
var total = new Date().getTime() - self.started;
|
||||
console.log('Upgrade took ' + total + 'ms');
|
||||
console.log((self.io/(total/100)) + ' % of the time went to IO (' + self.io + 'ms)');
|
||||
|
||||
if (window.console && console.log) {
|
||||
console.log('The upgrade process took ' + (total / 1000) + ' seconds. (' + (Math.round((self.io / (total / 100)) * 100) / 100) + ' % IO)' );
|
||||
}
|
||||
|
||||
// Terminate workers
|
||||
self.terminate();
|
||||
|
@ -347,6 +350,7 @@ self.io += new Date().getTime() - start;
|
|||
return;
|
||||
}
|
||||
|
||||
// Track time spent loading
|
||||
var start = new Date().getTime();
|
||||
librariesCache[key] = true;
|
||||
$.ajax({
|
||||
|
@ -382,6 +386,7 @@ self.io += new Date().getTime() - start;
|
|||
return;
|
||||
}
|
||||
|
||||
// Track time spent loading
|
||||
var start = new Date().getTime();
|
||||
$.ajax({
|
||||
dataType: 'script',
|
||||
|
|
Loading…
Reference in New Issue