array-buffer-cache-worker
Advanced tools
Comparing version 2.1.2 to 2.1.3
@@ -1,197 +0,10 @@ | ||
(function () { | ||
(function (_classCallCheck,_createClass) { | ||
'use strict'; | ||
var babelHelpers = {}; | ||
_classCallCheck = _classCallCheck && _classCallCheck.hasOwnProperty('default') ? _classCallCheck['default'] : _classCallCheck; | ||
_createClass = _createClass && _createClass.hasOwnProperty('default') ? _createClass['default'] : _createClass; | ||
var asyncGenerator = function () { | ||
function AwaitValue(value) { | ||
this.value = value; | ||
} | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function (resolve, reject) { | ||
var request = { | ||
key: key, | ||
arg: arg, | ||
resolve: resolve, | ||
reject: reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
if (value instanceof AwaitValue) { | ||
Promise.resolve(value.value).then(function (arg) { | ||
resume("next", arg); | ||
}, function (arg) { | ||
resume("throw", arg); | ||
}); | ||
} else { | ||
settle(result.done ? "return" : "normal", result.value); | ||
} | ||
} catch (err) { | ||
settle("throw", err); | ||
} | ||
} | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
break; | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
default: | ||
front.resolve({ | ||
value: value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
front = front.next; | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
this._invoke = send; | ||
if (typeof gen.return !== "function") { | ||
this.return = undefined; | ||
} | ||
} | ||
if (typeof Symbol === "function" && Symbol.asyncIterator) { | ||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () { | ||
return this; | ||
}; | ||
} | ||
AsyncGenerator.prototype.next = function (arg) { | ||
return this._invoke("next", arg); | ||
}; | ||
AsyncGenerator.prototype.throw = function (arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
AsyncGenerator.prototype.return = function (arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
return { | ||
wrap: function (fn) { | ||
return function () { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
}, | ||
await: function (value) { | ||
return new AwaitValue(value); | ||
} | ||
}; | ||
}(); | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
var createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
babelHelpers; | ||
var ArrayBufferStore = function () { | ||
function ArrayBufferStore() { | ||
classCallCheck(this, ArrayBufferStore); | ||
_classCallCheck(this, ArrayBufferStore); | ||
@@ -201,3 +14,3 @@ this._store = new Map(); | ||
createClass(ArrayBufferStore, [{ | ||
_createClass(ArrayBufferStore, [{ | ||
key: "clone", | ||
@@ -238,2 +51,3 @@ value: function clone(id) { | ||
}]); | ||
return ArrayBufferStore; | ||
@@ -303,2 +117,2 @@ }(); | ||
}()); | ||
}(_classCallCheck,_createClass)); |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";!function(){function e(e){this.value=e}function r(r){function t(o,a){try{var s=r[o](a),i=s.value;i instanceof e?Promise.resolve(i.value).then(function(e){t("next",e)},function(e){t("throw",e)}):n(s.done?"return":"normal",s.value)}catch(e){n("throw",e)}}function n(e,r){switch(e){case"return":o.resolve({value:r,done:!0});break;case"throw":o.reject(r);break;default:o.resolve({value:r,done:!1})}(o=o.next)?t(o.key,o.arg):a=null}var o,a;this._invoke=function(e,r){return new Promise(function(n,s){var i={key:e,arg:r,resolve:n,reject:s,next:null};a?a=a.next=i:(o=a=i,t(e,r))})},"function"!=typeof r.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(r.prototype[Symbol.asyncIterator]=function(){return this}),r.prototype.next=function(e){return this._invoke("next",e)},r.prototype.throw=function(e){return this._invoke("throw",e)},r.prototype.return=function(e){return this._invoke("return",e)}}();var e=function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")},r=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),t=new(function(){function t(){e(this,t),this._store=new Map}return r(t,[{key:"clone",value:function(e){var r=this._store.get(e);if(void 0===r)throw new Error('There is no arrayBuffer stored with an id called "'+e+'".');return r.slice(0)}},{key:"purge",value:function(e){if(!this._store.delete(e))throw new Error('There is no arrayBuffer stored with an id called "'+e+'".')}},{key:"slice",value:function(e,r,t){var n=this._store.get(e);if(void 0===n)throw new Error('There is no arrayBuffer stored with an id called "'+e+'".');return n.slice(r,null===t?n.byteLength:t)}},{key:"store",value:function(e,r){if(this._store.has(e))throw new Error('There is already an arrayBuffer stored with an id called "'+e+'".');this._store.set(e,r)}}]),t}());addEventListener("message",function e(r,n){var o=n.data;try{if("clone"===o.method){var a=o.id,s=o.params.arrayBufferId,i=t.clone(s);r.postMessage({error:null,id:a,result:{arrayBuffer:i}},[i])}else if("connect"===o.method){var u=o.id,l=o.params.port;l.start(),l.addEventListener("message",e.bind(null,l)),r.postMessage({error:null,id:u,result:null})}else if("disconnect"===o.method){var f=o.id;o.params.port.close(),r.postMessage({error:null,id:f,result:null})}else if("purge"===o.method){var c=o.id,d=o.params.arrayBufferId;t.purge(d),r.postMessage({error:null,id:c,result:null})}else if("slice"===o.method){var h=o.id,v=o.params,y=v.arrayBufferId,p=v.begin,m=v.end,w=void 0===m?null:m,g=t.slice(y,p,w);r.postMessage({error:null,id:h,result:{arrayBuffer:g}},[g])}else if("store"===o.method){var b=o.id,k=o.params,B=k.arrayBuffer,_=k.arrayBufferId;t.store(_,B),r.postMessage({error:null,id:b,result:null})}}catch(e){r.postMessage({error:{message:e.message},id:o.id,result:null})}}.bind(null,self))}(); | ||
!function(e,r){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,r=r&&r.hasOwnProperty("default")?r.default:r;var s=new(function(){function s(){e(this,s),this._store=new Map}return r(s,[{key:"clone",value:function(e){var r=this._store.get(e);if(void 0===r)throw new Error('There is no arrayBuffer stored with an id called "'+e+'".');return r.slice(0)}},{key:"purge",value:function(e){if(!this._store.delete(e))throw new Error('There is no arrayBuffer stored with an id called "'+e+'".')}},{key:"slice",value:function(e,r,s){var a=this._store.get(e);if(void 0===a)throw new Error('There is no arrayBuffer stored with an id called "'+e+'".');return a.slice(r,null===s?a.byteLength:s)}},{key:"store",value:function(e,r){if(this._store.has(e))throw new Error('There is already an arrayBuffer stored with an id called "'+e+'".');this._store.set(e,r)}}]),s}());addEventListener("message",function e(r,a){var t=a.data;try{if("clone"===t.method){var l=t.id,i=t.params.arrayBufferId,n=s.clone(i);r.postMessage({error:null,id:l,result:{arrayBuffer:n}},[n])}else if("connect"===t.method){var o=t.id,u=t.params.port;u.start(),u.addEventListener("message",e.bind(null,u)),r.postMessage({error:null,id:o,result:null})}else if("disconnect"===t.method){var d=t.id;t.params.port.close(),r.postMessage({error:null,id:d,result:null})}else if("purge"===t.method){var f=t.id,c=t.params.arrayBufferId;s.purge(c),r.postMessage({error:null,id:f,result:null})}else if("slice"===t.method){var h=t.id,p=t.params,y=p.arrayBufferId,v=p.begin,g=p.end,m=void 0===g?null:g,w=s.slice(y,v,m);r.postMessage({error:null,id:h,result:{arrayBuffer:w}},[w])}else if("store"===t.method){var B=t.id,M=t.params,_=M.arrayBuffer,E=M.arrayBufferId;s.store(E,_),r.postMessage({error:null,id:B,result:null})}}catch(e){r.postMessage({error:{message:e.message},id:t.id,result:null})}}.bind(null,self))}(_classCallCheck,_createClass); |
@@ -10,4 +10,5 @@ { | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-es2015": "^6.18.0", | ||
"chai": "^4.1.1", | ||
"chai": "^4.1.2", | ||
"eslint-config-holy-grail": "^20.0.0", | ||
@@ -40,5 +41,5 @@ "greenkeeper-lockfile": "^1.8.1", | ||
"ts-loader": "^2.3.4", | ||
"tsconfig-holy-grail": "^2.2.27", | ||
"tsconfig-holy-grail": "^2.4.0", | ||
"tslint": "^5.7.0", | ||
"tslint-config-holy-grail": "^11.0.0", | ||
"tslint-config-holy-grail": "^11.0.1", | ||
"typescript": "^2.5.2", | ||
@@ -68,4 +69,6 @@ "webpack": "^3.5.5" | ||
"types": "build/es2015/module.d.ts", | ||
"version": "2.1.2", | ||
"dependencies": {} | ||
"version": "2.1.3", | ||
"dependencies": { | ||
"babel-runtime": "^6.26.0" | ||
} | ||
} |
41164
1
37
605
+ Addedbabel-runtime@^6.26.0
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addedregenerator-runtime@0.11.1(transitive)