Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
39
assets/webapps/system.gaiamobile.org/shared/js/gzip/gzip.js
Normal file
39
assets/webapps/system.gaiamobile.org/shared/js/gzip/gzip.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/* exported Gzip */
|
||||
'use strict';
|
||||
|
||||
var Gzip = {
|
||||
|
||||
WORKER_URL: '/shared/js/gzip/gzip_worker.js',
|
||||
compress: function(payload) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
var worker = new Worker(this.WORKER_URL);
|
||||
|
||||
// Protect against the worker failing for whatever reason.
|
||||
var workerTimeout = setTimeout(function() {
|
||||
worker.terminate();
|
||||
reject('Failed to compress: gzip worker did not respond.');
|
||||
}, 10000);
|
||||
|
||||
worker.onmessage = function(msg) {
|
||||
clearTimeout(workerTimeout);
|
||||
worker.terminate();
|
||||
|
||||
var data = msg.data;
|
||||
if (data.returnResult) {
|
||||
resolve(data.gzipData);
|
||||
}
|
||||
else {
|
||||
reject('Failed to compress: ' + data.error);
|
||||
}
|
||||
};
|
||||
|
||||
worker.postMessage({
|
||||
cmd: 'gzip',
|
||||
payload: payload
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
Reference in a new issue