summaryrefslogtreecommitdiffstats
path: root/src/util.ts
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2018-11-17 13:51:38 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2018-11-17 13:51:38 +0100
commit38e90fc2e309d394832eee471d4cb9877ae908e2 (patch)
treed0c162d8c4935e05396ac804e323cc8188565a38 /src/util.ts
parent49699eeb453b3ea8b934a6a69795e9db26d523c3 (diff)
downloadrpgedit-38e90fc2e309d394832eee471d4cb9877ae908e2.tar
rpgedit-38e90fc2e309d394832eee471d4cb9877ae908e2.zip
GameContext: async render loop
Diffstat (limited to 'src/util.ts')
-rw-r--r--src/util.ts4
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));
+}