diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-11-17 13:51:38 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-11-17 13:51:38 +0100 |
commit | 38e90fc2e309d394832eee471d4cb9877ae908e2 (patch) | |
tree | d0c162d8c4935e05396ac804e323cc8188565a38 /src/util.ts | |
parent | 49699eeb453b3ea8b934a6a69795e9db26d523c3 (diff) | |
download | rpgedit-38e90fc2e309d394832eee471d4cb9877ae908e2.tar rpgedit-38e90fc2e309d394832eee471d4cb9877ae908e2.zip |
GameContext: async render loop
Diffstat (limited to 'src/util.ts')
-rw-r--r-- | src/util.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util.ts b/src/util.ts index 73e30d0..cea404b 100644 --- a/src/util.ts +++ b/src/util.ts @@ -78,3 +78,7 @@ export function get(url: string): Promise<XMLHttpRequest> { export async function getJSON(url: string): Promise<any> { return JSON.parse((await get(url)).responseText); } + +export function nextAnimationFrame(): Promise<DOMHighResTimeStamp> { + return new Promise((resolve) => window.requestAnimationFrame(resolve)); +} |