array-buffer-cache-worker
Advanced tools
Comparing version 1.0.2 to 2.0.0
@@ -1,4 +0,11 @@ | ||
export * from './array-buffer-cache-clone-event'; | ||
export * from './array-buffer-cache-purge-event'; | ||
export * from './array-buffer-cache-slice-event'; | ||
export * from './array-buffer-cache-store-event'; | ||
export * from './broker-event'; | ||
export * from './clone-request'; | ||
export * from './clone-response'; | ||
export * from './error-response'; | ||
export * from './purge-request'; | ||
export * from './purge-response'; | ||
export * from './slice-request'; | ||
export * from './slice-response'; | ||
export * from './store-request'; | ||
export * from './store-response'; | ||
export * from './worker-event'; |
@@ -5,27 +5,33 @@ import { ArrayBufferStore } from './helpers/array-buffer-store'; | ||
try { | ||
if (data.action === 'clone') { | ||
const { action, id } = data; | ||
const arrayBuffer = arrayBufferStore.clone(id); | ||
postMessage({ action, arrayBuffer, id }, [arrayBuffer]); | ||
if (data.method === 'clone') { | ||
const { id, params: { arrayBufferId } } = data; | ||
const arrayBuffer = arrayBufferStore.clone(arrayBufferId); | ||
postMessage({ error: null, id, result: { arrayBuffer } }, [arrayBuffer]); | ||
} | ||
else if (data.action === 'purge') { | ||
const { action, id } = data; | ||
arrayBufferStore.purge(id); | ||
postMessage({ action, id }); | ||
else if (data.method === 'purge') { | ||
const { id, params: { arrayBufferId } } = data; | ||
arrayBufferStore.purge(arrayBufferId); | ||
postMessage({ error: null, id, result: null }); | ||
} | ||
else if (data.action === 'slice') { | ||
const { action, begin, end = null, id } = data; | ||
const arrayBuffer = arrayBufferStore.slice(id, begin, end); | ||
postMessage({ action, arrayBuffer, id }, [arrayBuffer]); | ||
else if (data.method === 'slice') { | ||
const { id, params: { arrayBufferId, begin, end = null } } = data; | ||
const arrayBuffer = arrayBufferStore.slice(arrayBufferId, begin, end); | ||
postMessage({ error: null, id, result: { arrayBuffer } }, [arrayBuffer]); | ||
} | ||
else if (data.action === 'store') { | ||
const { action, arrayBuffer, id } = data; | ||
arrayBufferStore.store(id, arrayBuffer); | ||
postMessage({ action, id }); | ||
else if (data.method === 'store') { | ||
const { id, params: { arrayBuffer, arrayBufferId } } = data; | ||
arrayBufferStore.store(arrayBufferId, arrayBuffer); | ||
postMessage({ error: null, id, result: null }); | ||
} | ||
} | ||
catch (err) { | ||
postMessage({ err: { message: err.message } }); | ||
postMessage({ | ||
error: { | ||
message: err.message | ||
}, | ||
id: data.id, | ||
result: null | ||
}); | ||
} | ||
}); | ||
//# sourceMappingURL=/users/chrisguttandin/repositories/array-buffer-cache-worker/node_modules/tsconfig-holy-grail/src/module.js.map |
@@ -1,1 +0,2 @@ | ||
export * from './array-buffer-cache-event'; | ||
export * from './broker-message'; | ||
export * from './worker-message'; |
@@ -60,33 +60,41 @@ (function () { | ||
try { | ||
if (data.action === 'clone') { | ||
var action = data.action, | ||
id = data.id; | ||
if (data.method === 'clone') { | ||
var id = data.id, | ||
arrayBufferId = data.params.arrayBufferId; | ||
var arrayBuffer = arrayBufferStore.clone(id); | ||
postMessage({ action: action, arrayBuffer: arrayBuffer, id: id }, [arrayBuffer]); | ||
} else if (data.action === 'purge') { | ||
var _action = data.action, | ||
_id = data.id; | ||
var arrayBuffer = arrayBufferStore.clone(arrayBufferId); | ||
postMessage({ error: null, id: id, result: { arrayBuffer: arrayBuffer } }, [arrayBuffer]); | ||
} else if (data.method === 'purge') { | ||
var _id = data.id, | ||
_arrayBufferId = data.params.arrayBufferId; | ||
arrayBufferStore.purge(_id); | ||
postMessage({ action: _action, id: _id }); | ||
} else if (data.action === 'slice') { | ||
var _action2 = data.action, | ||
begin = data.begin, | ||
_data$end = data.end, | ||
end = _data$end === undefined ? null : _data$end, | ||
_id2 = data.id; | ||
arrayBufferStore.purge(_arrayBufferId); | ||
postMessage({ error: null, id: _id, result: null }); | ||
} else if (data.method === 'slice') { | ||
var _id2 = data.id, | ||
_data$params = data.params, | ||
_arrayBufferId2 = _data$params.arrayBufferId, | ||
begin = _data$params.begin, | ||
_data$params$end = _data$params.end, | ||
end = _data$params$end === undefined ? null : _data$params$end; | ||
var _arrayBuffer = arrayBufferStore.slice(_id2, begin, end); | ||
postMessage({ action: _action2, arrayBuffer: _arrayBuffer, id: _id2 }, [_arrayBuffer]); | ||
} else if (data.action === 'store') { | ||
var _action3 = data.action, | ||
_arrayBuffer2 = data.arrayBuffer, | ||
_id3 = data.id; | ||
var _arrayBuffer = arrayBufferStore.slice(_arrayBufferId2, begin, end); | ||
postMessage({ error: null, id: _id2, result: { arrayBuffer: _arrayBuffer } }, [_arrayBuffer]); | ||
} else if (data.method === 'store') { | ||
var _id3 = data.id, | ||
_data$params2 = data.params, | ||
_arrayBuffer2 = _data$params2.arrayBuffer, | ||
_arrayBufferId3 = _data$params2.arrayBufferId; | ||
arrayBufferStore.store(_id3, _arrayBuffer2); | ||
postMessage({ action: _action3, id: _id3 }); | ||
arrayBufferStore.store(_arrayBufferId3, _arrayBuffer2); | ||
postMessage({ error: null, id: _id3, result: null }); | ||
} | ||
} catch (err) { | ||
postMessage({ err: { message: err.message } }); | ||
postMessage({ | ||
error: { | ||
message: err.message | ||
}, | ||
id: data.id, | ||
result: null | ||
}); | ||
} | ||
@@ -93,0 +101,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";function e(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var 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){var r=e.data;try{if("clone"===r.action){var n=r.action,a=r.id,i=t.clone(a);postMessage({action:n,arrayBuffer:i,id:a},[i])}else if("purge"===r.action){var o=r.action,s=r.id;t.purge(s),postMessage({action:o,id:s})}else if("slice"===r.action){var c=r.action,f=r.begin,u=r.end,l=void 0===u?null:u,d=r.id,h=t.slice(d,f,l);postMessage({action:c,arrayBuffer:h,id:d},[h])}else if("store"===r.action){var v=r.action,y=r.arrayBuffer,g=r.id;t.store(g,y),postMessage({action:v,id:g})}}catch(e){postMessage({err:{message:e.message}})}})}(); | ||
!function(){"use strict";function e(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,r){for(var t=0;t<r.length;t++){var a=r[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(r,t,a){return t&&e(r.prototype,t),a&&e(r,a),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 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===t?a.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){var r=e.data;try{if("clone"===r.method){var a=r.id,n=r.params.arrayBufferId,s=t.clone(n);postMessage({error:null,id:a,result:{arrayBuffer:s}},[s])}else if("purge"===r.method){var i=r.id,o=r.params.arrayBufferId;t.purge(o),postMessage({error:null,id:i,result:null})}else if("slice"===r.method){var l=r.id,u=r.params,f=u.arrayBufferId,d=u.begin,c=u.end,h=void 0===c?null:c,y=t.slice(f,d,h);postMessage({error:null,id:l,result:{arrayBuffer:y}},[y])}else if("store"===r.method){var v=r.id,g=r.params,p=g.arrayBuffer,w=g.arrayBufferId;t.store(w,p),postMessage({error:null,id:v,result:null})}}catch(e){postMessage({error:{message:e.message},id:r.id,result:null})}})}(); |
@@ -6,27 +6,33 @@ import { ArrayBufferStore } from './helpers/array-buffer-store'; | ||
try { | ||
if (data.action === 'clone') { | ||
var action = data.action, id = data.id; | ||
var arrayBuffer = arrayBufferStore.clone(id); | ||
postMessage({ action: action, arrayBuffer: arrayBuffer, id: id }, [arrayBuffer]); | ||
if (data.method === 'clone') { | ||
var id = data.id, arrayBufferId = data.params.arrayBufferId; | ||
var arrayBuffer = arrayBufferStore.clone(arrayBufferId); | ||
postMessage({ error: null, id: id, result: { arrayBuffer: arrayBuffer } }, [arrayBuffer]); | ||
} | ||
else if (data.action === 'purge') { | ||
var action = data.action, id = data.id; | ||
arrayBufferStore.purge(id); | ||
postMessage({ action: action, id: id }); | ||
else if (data.method === 'purge') { | ||
var id = data.id, arrayBufferId = data.params.arrayBufferId; | ||
arrayBufferStore.purge(arrayBufferId); | ||
postMessage({ error: null, id: id, result: null }); | ||
} | ||
else if (data.action === 'slice') { | ||
var action = data.action, begin = data.begin, _b = data.end, end = _b === void 0 ? null : _b, id = data.id; | ||
var arrayBuffer = arrayBufferStore.slice(id, begin, end); | ||
postMessage({ action: action, arrayBuffer: arrayBuffer, id: id }, [arrayBuffer]); | ||
else if (data.method === 'slice') { | ||
var id = data.id, _b = data.params, arrayBufferId = _b.arrayBufferId, begin = _b.begin, _c = _b.end, end = _c === void 0 ? null : _c; | ||
var arrayBuffer = arrayBufferStore.slice(arrayBufferId, begin, end); | ||
postMessage({ error: null, id: id, result: { arrayBuffer: arrayBuffer } }, [arrayBuffer]); | ||
} | ||
else if (data.action === 'store') { | ||
var action = data.action, arrayBuffer = data.arrayBuffer, id = data.id; | ||
arrayBufferStore.store(id, arrayBuffer); | ||
postMessage({ action: action, id: id }); | ||
else if (data.method === 'store') { | ||
var id = data.id, _d = data.params, arrayBuffer = _d.arrayBuffer, arrayBufferId = _d.arrayBufferId; | ||
arrayBufferStore.store(arrayBufferId, arrayBuffer); | ||
postMessage({ error: null, id: id, result: null }); | ||
} | ||
} | ||
catch (err) { | ||
postMessage({ err: { message: err.message } }); | ||
postMessage({ | ||
error: { | ||
message: err.message | ||
}, | ||
id: data.id, | ||
result: null | ||
}); | ||
} | ||
}); | ||
//# sourceMappingURL=/users/chrisguttandin/repositories/array-buffer-cache-worker/node_modules/tsconfig-holy-grail/src/module.js.map |
@@ -62,3 +62,3 @@ { | ||
"types": "build/es2015/module.d.ts", | ||
"version": "1.0.2" | ||
"version": "2.0.0" | ||
} |
@@ -1,4 +0,11 @@ | ||
export * from './array-buffer-cache-clone-event'; | ||
export * from './array-buffer-cache-purge-event'; | ||
export * from './array-buffer-cache-slice-event'; | ||
export * from './array-buffer-cache-store-event'; | ||
export * from './broker-event'; | ||
export * from './clone-request'; | ||
export * from './clone-response'; | ||
export * from './error-response'; | ||
export * from './purge-request'; | ||
export * from './purge-response'; | ||
export * from './slice-request'; | ||
export * from './slice-response'; | ||
export * from './store-request'; | ||
export * from './store-response'; | ||
export * from './worker-event'; |
import { ArrayBufferStore } from './helpers/array-buffer-store'; | ||
import { TArrayBufferCacheEvent } from './types'; | ||
import { IBrokerEvent, ICloneResponse, IErrorResponse, IPurgeResponse, ISliceResponse, IStoreResponse } from './interfaces'; | ||
@@ -9,32 +9,38 @@ export * from './interfaces'; | ||
addEventListener('message', ({ data }: TArrayBufferCacheEvent) => { | ||
addEventListener('message', ({ data }: IBrokerEvent) => { | ||
try { | ||
if (data.action === 'clone') { | ||
const { action, id } = data; | ||
if (data.method === 'clone') { | ||
const { id, params: { arrayBufferId } } = data; | ||
const arrayBuffer = arrayBufferStore.clone(id); | ||
const arrayBuffer = arrayBufferStore.clone(arrayBufferId); | ||
postMessage({ action, arrayBuffer, id }, [ arrayBuffer ]); | ||
} else if (data.action === 'purge') { | ||
const { action, id } = data; | ||
postMessage(<ICloneResponse> { error: null, id, result: { arrayBuffer } }, [ arrayBuffer ]); | ||
} else if (data.method === 'purge') { | ||
const { id, params: { arrayBufferId } } = data; | ||
arrayBufferStore.purge(id); | ||
arrayBufferStore.purge(arrayBufferId); | ||
postMessage({ action, id }); | ||
} else if (data.action === 'slice') { | ||
const { action, begin, end = null, id } = data; | ||
postMessage(<IPurgeResponse> { error: null, id, result: null }); | ||
} else if (data.method === 'slice') { | ||
const { id, params: { arrayBufferId, begin, end = null } } = data; | ||
const arrayBuffer = arrayBufferStore.slice(id, begin, end); | ||
const arrayBuffer = arrayBufferStore.slice(arrayBufferId, begin, end); | ||
postMessage({ action, arrayBuffer, id }, [ arrayBuffer ]); | ||
} else if (data.action === 'store') { | ||
const { action, arrayBuffer, id } = data; | ||
postMessage(<ISliceResponse> { error: null, id, result: { arrayBuffer } }, [ arrayBuffer ]); | ||
} else if (data.method === 'store') { | ||
const { id, params: { arrayBuffer, arrayBufferId } } = data; | ||
arrayBufferStore.store(id, arrayBuffer); | ||
arrayBufferStore.store(arrayBufferId, arrayBuffer); | ||
postMessage({ action, id }); | ||
postMessage(<IStoreResponse> { error: null, id, result: null }); | ||
} | ||
} catch (err) { | ||
postMessage({ err: { message: err.message } }); | ||
postMessage(<IErrorResponse> { | ||
error: { | ||
message: err.message | ||
}, | ||
id: data.id, | ||
result: null | ||
}); | ||
} | ||
}); |
@@ -1,1 +0,2 @@ | ||
export * from './array-buffer-cache-event'; | ||
export * from './broker-message'; | ||
export * from './worker-message'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
36911
107
481
1