@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.
23 lines • 822 B
JavaScript
export function awaitInputAsync() {
return new Promise((res, _) => {
const callback = () => {
if (fn == undefined)
return;
document.removeEventListener('pointerdown', fn);
document.removeEventListener('click', fn);
document.removeEventListener('dragstart', fn);
document.removeEventListener('touchstart', fn);
res();
};
const fn = callback;
document.addEventListener('pointerdown', fn);
document.addEventListener('click', fn);
document.addEventListener('dragstart', fn);
document.addEventListener('touchstart', fn);
});
}
export async function awaitInput(cb) {
await awaitInputAsync();
cb();
}
//# sourceMappingURL=engine_input_utils.js.map