UNPKG

@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.

24 lines (21 loc) 779 B
export function awaitInputAsync() : Promise<void> { 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(); }