@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
20 lines • 651 B
JavaScript
// registry
export const binaryIdentifierCasts = {};
export function registerBinaryType(identifier, cast) {
binaryIdentifierCasts[identifier] = cast;
}
// called by networking on receiving a new binary blob
// it's just a little helper method so listeners dont have to cast to types every time
export function tryCastBinary(bin) {
const id = bin.getBufferIdentifier();
const cast = binaryIdentifierCasts[id];
const mod = cast(bin);
return mod;
}
export function tryGetGuid(obj) {
if (typeof obj["guid"] === "function") {
return obj.guid();
}
return null;
}
//# sourceMappingURL=schemes.js.map