@haelp/teto
Version:
A typescript-based controllable TETR.IO client.
42 lines (41 loc) • 1.02 kB
JavaScript
import { Packr, Unpackr, addExtension } from "./ts-wrap.mjs";
// require theorypack extensions
addExtension({
Class: undefined,
type: 1,
read: (e)=>null === e ? {
success: true
} : {
success: true,
...e
}
});
addExtension({
Class: undefined,
type: 2,
read: (e)=>null === e ? {
success: false
} : {
success: false,
error: e
}
});
const unpacker = new Unpackr({
int64AsType: "number",
bundleStrings: true,
sequential: false
});
const packer = new Packr({
int64AsType: "number",
bundleStrings: true,
sequential: false
});
(function(pack) {
pack.unpack = unpacker.unpack.bind(unpacker);
pack.unpackMultiple = unpacker.unpackMultiple.bind(unpacker);
pack.decode = packer.decode.bind(unpacker);
pack.pack = packer.pack.bind(packer);
pack.encode = packer.encode.bind(packer);
})(pack || (pack = {}));
export var pack;
//# sourceMappingURL=index.js.map