async-array-buffer-broker
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -0,1 +1,7 @@ | ||
export declare const wrap: (worker: MessagePort | Worker) => { | ||
allocate: (length: number) => Promise<ArrayBuffer>; | ||
connect: (port: MessagePort) => Promise<void>; | ||
deallocate: (arrayBuffer: ArrayBuffer) => void; | ||
disconnect: (port: MessagePort) => Promise<void>; | ||
}; | ||
export declare const load: (url: string) => { | ||
@@ -2,0 +8,0 @@ allocate: (length: number) => Promise<ArrayBuffer>; |
@@ -9,4 +9,3 @@ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; | ||
}; | ||
export const load = (url) => { | ||
const worker = new Worker(url); | ||
export const wrap = (worker) => { | ||
const ongoingRequests = new Set(); | ||
@@ -83,2 +82,6 @@ const allocate = (length) => { | ||
}; | ||
export const load = (url) => { | ||
const worker = new Worker(url); | ||
return wrap(worker); | ||
}; | ||
//# sourceMappingURL=/users/chrisguttandin/repositories/async-array-buffer-broker/node_modules/tsconfig-holy-grail/src/module.js.map |
@@ -15,4 +15,3 @@ (function (global, factory) { | ||
}; | ||
var load = function load(url) { | ||
var worker = new Worker(url); | ||
var wrap = function wrap(worker) { | ||
var ongoingRequests = new Set(); | ||
@@ -92,3 +91,8 @@ var allocate = function allocate(length) { | ||
}; | ||
var load = function load(url) { | ||
var worker = new Worker(url); | ||
return wrap(worker); | ||
}; | ||
exports.wrap = wrap; | ||
exports.load = load; | ||
@@ -95,0 +99,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.asyncArrayBufferBroker={})}(this,function(e){"use strict";var r=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,n=function(e){for(var n=Math.round(Math.random()*r);e.has(n);)n=Math.round(Math.random()*r);return n};e.load=function(e){var r=new Worker(e),t=new Set;return{allocate:function(e){return new Promise(function(a,o){var s=n(t);t.add(s),r.addEventListener("message",function e(n){var d=n.data;d.id===s&&(t.delete(s),r.removeEventListener("message",e),null===d.error?a(d.result.arrayBuffer):o(new Error(d.error.message)))}),r.postMessage({id:s,method:"allocate",params:{length:e}})})},connect:function(e){return new Promise(function(a,o){var s=n(t);t.add(s),r.addEventListener("message",function e(n){var d=n.data;d.id===s&&(t.delete(s),r.removeEventListener("message",e),null===d.error?a():o(new Error(d.error.message)))}),r.postMessage({id:s,method:"connect",params:{port:e}},[e])})},deallocate:function(e){r.postMessage({id:null,method:"deallocate",params:{arrayBuffer:e}},[e])},disconnect:function(e){return new Promise(function(a,o){var s=n(t);t.add(s),r.addEventListener("message",function e(n){var d=n.data;d.id===s&&(t.delete(s),r.removeEventListener("message",e),null===d.error?a():o(new Error(d.error.message)))}),r.postMessage({id:s,method:"disconnect",params:{port:e}},[e])})}}},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.asyncArrayBufferBroker={})}(this,function(e){"use strict";var r=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,n=function(e){for(var n=Math.round(Math.random()*r);e.has(n);)n=Math.round(Math.random()*r);return n},t=function(e){var r=new Set;return{allocate:function(t){return new Promise(function(a,o){var s=n(r);r.add(s),e.addEventListener("message",function n(t){var d=t.data;d.id===s&&(r.delete(s),e.removeEventListener("message",n),null===d.error?a(d.result.arrayBuffer):o(new Error(d.error.message)))}),e.postMessage({id:s,method:"allocate",params:{length:t}})})},connect:function(t){return new Promise(function(a,o){var s=n(r);r.add(s),e.addEventListener("message",function n(t){var d=t.data;d.id===s&&(r.delete(s),e.removeEventListener("message",n),null===d.error?a():o(new Error(d.error.message)))}),e.postMessage({id:s,method:"connect",params:{port:t}},[t])})},deallocate:function(r){e.postMessage({id:null,method:"deallocate",params:{arrayBuffer:r}},[r])},disconnect:function(t){return new Promise(function(a,o){var s=n(r);r.add(s),e.addEventListener("message",function n(t){var d=t.data;d.id===s&&(r.delete(s),e.removeEventListener("message",n),null===d.error?a():o(new Error(d.error.message)))}),e.postMessage({id:s,method:"disconnect",params:{port:t}},[t])})}}};e.wrap=t,e.load=function(e){var r=new Worker(e);return t(r)},Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -9,4 +9,3 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; | ||
}; | ||
export var load = function (url) { | ||
var worker = new Worker(url); | ||
export var wrap = function (worker) { | ||
var ongoingRequests = new Set(); | ||
@@ -86,2 +85,6 @@ var allocate = function (length) { | ||
}; | ||
export var load = function (url) { | ||
var worker = new Worker(url); | ||
return wrap(worker); | ||
}; | ||
//# sourceMappingURL=/users/chrisguttandin/repositories/async-array-buffer-broker/node_modules/tsconfig-holy-grail/src/module.js.map |
@@ -27,2 +27,3 @@ { | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-leche": "0.0.13", | ||
"karma-mocha": "^1.2.0", | ||
@@ -66,3 +67,3 @@ "karma-safari-launcher": "^1.0.0", | ||
"types": "build/es2015/module.d.ts", | ||
"version": "1.1.0" | ||
"version": "1.2.0" | ||
} |
@@ -22,5 +22,3 @@ import { | ||
export const load = (url: string) => { | ||
const worker = new Worker(url); | ||
export const wrap = (worker: MessagePort | Worker) => { | ||
const ongoingRequests: Set<number> = new Set(); | ||
@@ -117,1 +115,7 @@ | ||
}; | ||
export const load = (url: string) => { | ||
const worker = new Worker(url); | ||
return wrap(worker); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
25572
368
33