You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2022/01/15 23:01:44 UTC
[royale-asjs] branch develop updated: Simplified callLater
This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 6c872cf Simplified callLater
6c872cf is described below
commit 6c872cfb9fb6b167f10117bf2fc5920c91d402f1
Author: Harbs <ha...@in-tools.com>
AuthorDate: Sun Jan 16 01:01:31 2022 +0200
Simplified callLater
---
.../main/royale/org/apache/royale/utils/callLater.as | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/callLater.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/callLater.as
index d6f0fa3..ad411f2 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/callLater.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/callLater.as
@@ -27,18 +27,15 @@ package org.apache.royale.utils
*/
public function callLater(fn:Function, args:Array = null, thisArg:Object = null):void
{
- var calls:Array = [ {thisArg: thisArg, fn: fn, args: args } ];
- setTimeout(makeCalls, 0);
- function makeCalls():void
+ COMPILE::SWF{
+ setTimeout(callback, 0);
+ }
+ COMPILE::JS{
+ requestAnimationFrame(callback);
+ }
+ function callback():void
{
- var list:Array = calls;
- var n:int = list.length;
- for (var i:int = 0; i < n; i++)
- {
- var call:Object = list.shift();
- var fn:Function = call.fn;
- fn.apply(call.thisArg, call.args);
- }
+ fn.apply(thisArg,args);
}
}
}