namespace cleanup for workers
This commit is contained in:
parent
d148fe6ae7
commit
4cae0b945a
4 changed files with 35 additions and 23 deletions
|
|
@ -8,12 +8,17 @@
|
|||
|
||||
const BASE = self.base, KIRI = self.kiri, handlers = {};
|
||||
|
||||
KIRI.codec = {
|
||||
const codec = KIRI.codec = {
|
||||
encode: encode,
|
||||
decode: decode,
|
||||
registerDecoder: registerDecoder
|
||||
registerDecoder: registerDecoder,
|
||||
allocFloat32Array: allocFloat32Array
|
||||
};
|
||||
|
||||
function allocFloat32Array(len) {
|
||||
return new Float32Array(len);
|
||||
}
|
||||
|
||||
function encode(o, state) {
|
||||
state = state || {};
|
||||
if (o === null) return null;
|
||||
|
|
@ -140,7 +145,7 @@
|
|||
function encodePointArray(points, state) {
|
||||
if (!points) return null;
|
||||
|
||||
let array = new Float32Array(points.length * 3),
|
||||
let array = codec.allocFloat32Array(points.length * 3),
|
||||
pos = 0;
|
||||
|
||||
points.forEach(function(point) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue