Re: git commit: [flex-asjs] [refs/heads/tlf] - Added callLater

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: git commit: [flex-asjs] [refs/heads/tlf] - Added callLater

Alex Harui-2
FWIW, There is already a CallLaterBead.

-Alex

On 6/18/17, 3:34 AM, "[hidden email]" <[hidden email]> wrote:

>Repository: flex-asjs
>Updated Branches:
>  refs/heads/tlf 914e666c7 -> 06f47590c
>
>
>Added callLater
>
>
>Project:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%7C01%7C%7Ce86106f11f6
>840ac975108d4b635a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6363337
>88909731382&sdata=QtzIK5XvaBgmhXtWEayKFxrhIW3lDfqqdZCTV%2BpU%2B6w%3D&reser
>ved=0
>Commit:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%2F06f47590&data=02%7C01%7C%
>7Ce86106f11f6840ac975108d4b635a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%
>7C0%7C636333788909741387&sdata=%2Bkuk1%2Fdy3bm0yPOnC%2BRtEpj5vMxis7sx%2B2T
>NOLktpr0%3D&reserved=0
>Tree:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F06f47590&data=02%7C01%7C%7C
>e86106f11f6840ac975108d4b635a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C
>0%7C636333788909741387&sdata=HOYnpt8VUo8XW640CBNCAsVs7wFVMPTFiiyrkl%2BFzgg
>%3D&reserved=0
>Diff:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F06f47590&data=02%7C01%7C%7C
>e86106f11f6840ac975108d4b635a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C
>0%7C636333788909741387&sdata=I1hVoA9HSTJtSLQOAJ2RYWJMC5x50cSfKM8bwYULW4w%3
>D&reserved=0
>
>Branch: refs/heads/tlf
>Commit: 06f47590cc13434f10f2612d64640bd872ff86bc
>Parents: 914e666
>Author: Added floor to binary search <[hidden email]>
>Authored: Sun Jun 18 13:34:41 2017 +0300
>Committer: Added floor to binary search <[hidden email]>
>Committed: Sun Jun 18 13:34:41 2017 +0300
>
>----------------------------------------------------------------------
> .../projects/Core/src/main/flex/CoreClasses.as  |  1 +
> .../flex/org/apache/flex/utils/callLater.as     | 42 ++++++++++++++++++++
> 2 files changed, 43 insertions(+)
>----------------------------------------------------------------------
>
>
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F06f47590%2Fframeworks%2Fpro
>jects%2FCore%2Fsrc%2Fmain%2Fflex%2FCoreClasses.as&data=02%7C01%7C%7Ce86106
>f11f6840ac975108d4b635a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63
>6333788909741387&sdata=OXW0E%2BdzkJty8HFtuYLQmgJi6wsyRMUjrAY3wuV3bHk%3D&re
>served=0
>----------------------------------------------------------------------
>diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as
>b/frameworks/projects/Core/src/main/flex/CoreClasses.as
>index 8578903..0aaa985 100644
>--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
>+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
>@@ -163,6 +163,7 @@ internal class CoreClasses
> import org.apache.flex.utils.HTMLLoader; HTMLLoader;
> }
> import org.apache.flex.utils.BrowserUtils; BrowserUtils;
>+ import org.apache.flex.utils.callLater; callLater;
>     import org.apache.flex.utils.CompressionUtils; CompressionUtils;
> import org.apache.flex.utils.Endian; Endian;
> import org.apache.flex.utils.JXON; JXON;
>
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F06f47590%2Fframeworks%2Fpro
>jects%2FCore%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%2Futils%2FcallLater
>.as&data=02%7C01%7C%7Ce86106f11f6840ac975108d4b635a3ea%7Cfa7b1b5a7b3443879
>4aed2c178decee1%7C0%7C0%7C636333788909741387&sdata=96YUaiTeiZLHQOF1%2FmUUQ
>zvnsn9I%2BxNuIO4xBgeGBPw%3D&reserved=0
>----------------------------------------------------------------------
>diff --git
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/callLater.a
>s
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/callLater.a
>s
>new file mode 100644
>index 0000000..23af5fe
>--- /dev/null
>+++
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/callLater.a
>s
>@@ -0,0 +1,42 @@
>+/////////////////////////////////////////////////////////////////////////
>///////
>+//
>+//  Licensed to the Apache Software Foundation (ASF) under one or more
>+//  contributor license agreements.  See the NOTICE file distributed with
>+//  this work for additional information regarding copyright ownership.
>+//  The ASF licenses this file to You under the Apache License, Version
>2.0
>+//  (the "License"); you may not use this file except in compliance with
>+//  the License.  You may obtain a copy of the License at
>+//
>+//      
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apache
>.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7C%7Ce86106f11f6840ac975108d4b6
>35a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636333788909741387&sda
>ta=galpC5ybMkoZTr%2FyF2i%2FAp8ezYgxAZi832DK9DZ8NkY%3D&reserved=0
>+//
>+//  Unless required by applicable law or agreed to in writing, software
>+//  distributed under the License is distributed on an "AS IS" BASIS,
>+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>implied.
>+//  See the License for the specific language governing permissions and
>+//  limitations under the License.
>+//
>+/////////////////////////////////////////////////////////////////////////
>///////
>+package org.apache.flex.utils
>+{
>+    COMPILE::SWF
>+    {
>+        import flash.utils.setTimeout;
>+    }
>+    
>+    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
>+        {
>+            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);
>+            }
>+        }
>+    }
>+}
>\ No newline at end of file
>

Reply | Threaded
Open this post in threaded view
|

Re: git commit: [flex-asjs] [refs/heads/tlf] - Added callLater

Harbs
Right. (I copied most of the code from there.) But that can only be called from a strand. I wanted a stand alone function that can be called from anywhere. I needed to call a method that breaks out of recursion in a non-strand class.

> On Jun 19, 2017, at 7:39 AM, Alex Harui <[hidden email]> wrote:
>
> FWIW, There is already a CallLaterBead.
>
> -Alex
>
> On 6/18/17, 3:34 AM, "[hidden email]" <[hidden email]> wrote:
>
>> Repository: flex-asjs
>> Updated Branches:
>> refs/heads/tlf 914e666c7 -> 06f47590c
>>
>>
>> Added callLater
>>
>>
>> Project:
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>> .apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%7C01%7C%7Ce86106f11f6
>> 840ac975108d4b635a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6363337
>> 88909731382&sdata=QtzIK5XvaBgmhXtWEayKFxrhIW3lDfqqdZCTV%2BpU%2B6w%3D&reser
>> ved=0
>> Commit:
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>> .apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%2F06f47590&data=02%7C01%7C%
>> 7Ce86106f11f6840ac975108d4b635a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%
>> 7C0%7C636333788909741387&sdata=%2Bkuk1%2Fdy3bm0yPOnC%2BRtEpj5vMxis7sx%2B2T
>> NOLktpr0%3D&reserved=0
>> Tree:
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>> .apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F06f47590&data=02%7C01%7C%7C
>> e86106f11f6840ac975108d4b635a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C
>> 0%7C636333788909741387&sdata=HOYnpt8VUo8XW640CBNCAsVs7wFVMPTFiiyrkl%2BFzgg
>> %3D&reserved=0
>> Diff:
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>> .apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F06f47590&data=02%7C01%7C%7C
>> e86106f11f6840ac975108d4b635a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C
>> 0%7C636333788909741387&sdata=I1hVoA9HSTJtSLQOAJ2RYWJMC5x50cSfKM8bwYULW4w%3
>> D&reserved=0
>>
>> Branch: refs/heads/tlf
>> Commit: 06f47590cc13434f10f2612d64640bd872ff86bc
>> Parents: 914e666
>> Author: Added floor to binary search <[hidden email]>
>> Authored: Sun Jun 18 13:34:41 2017 +0300
>> Committer: Added floor to binary search <[hidden email]>
>> Committed: Sun Jun 18 13:34:41 2017 +0300
>>
>> ----------------------------------------------------------------------
>> .../projects/Core/src/main/flex/CoreClasses.as  |  1 +
>> .../flex/org/apache/flex/utils/callLater.as     | 42 ++++++++++++++++++++
>> 2 files changed, 43 insertions(+)
>> ----------------------------------------------------------------------
>>
>>
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>> .apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F06f47590%2Fframeworks%2Fpro
>> jects%2FCore%2Fsrc%2Fmain%2Fflex%2FCoreClasses.as&data=02%7C01%7C%7Ce86106
>> f11f6840ac975108d4b635a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63
>> 6333788909741387&sdata=OXW0E%2BdzkJty8HFtuYLQmgJi6wsyRMUjrAY3wuV3bHk%3D&re
>> served=0
>> ----------------------------------------------------------------------
>> diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as
>> b/frameworks/projects/Core/src/main/flex/CoreClasses.as
>> index 8578903..0aaa985 100644
>> --- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
>> +++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
>> @@ -163,6 +163,7 @@ internal class CoreClasses
>> import org.apache.flex.utils.HTMLLoader; HTMLLoader;
>> }
>> import org.apache.flex.utils.BrowserUtils; BrowserUtils;
>> + import org.apache.flex.utils.callLater; callLater;
>>    import org.apache.flex.utils.CompressionUtils; CompressionUtils;
>> import org.apache.flex.utils.Endian; Endian;
>> import org.apache.flex.utils.JXON; JXON;
>>
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>> .apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F06f47590%2Fframeworks%2Fpro
>> jects%2FCore%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%2Futils%2FcallLater
>> .as&data=02%7C01%7C%7Ce86106f11f6840ac975108d4b635a3ea%7Cfa7b1b5a7b3443879
>> 4aed2c178decee1%7C0%7C0%7C636333788909741387&sdata=96YUaiTeiZLHQOF1%2FmUUQ
>> zvnsn9I%2BxNuIO4xBgeGBPw%3D&reserved=0
>> ----------------------------------------------------------------------
>> diff --git
>> a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/callLater.a
>> s
>> b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/callLater.a
>> s
>> new file mode 100644
>> index 0000000..23af5fe
>> --- /dev/null
>> +++
>> b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/callLater.a
>> s
>> @@ -0,0 +1,42 @@
>> +/////////////////////////////////////////////////////////////////////////
>> ///////
>> +//
>> +//  Licensed to the Apache Software Foundation (ASF) under one or more
>> +//  contributor license agreements.  See the NOTICE file distributed with
>> +//  this work for additional information regarding copyright ownership.
>> +//  The ASF licenses this file to You under the Apache License, Version
>> 2.0
>> +//  (the "License"); you may not use this file except in compliance with
>> +//  the License.  You may obtain a copy of the License at
>> +//
>> +//      
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apache
>> .org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7C%7Ce86106f11f6840ac975108d4b6
>> 35a3ea%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636333788909741387&sda
>> ta=galpC5ybMkoZTr%2FyF2i%2FAp8ezYgxAZi832DK9DZ8NkY%3D&reserved=0
>> +//
>> +//  Unless required by applicable law or agreed to in writing, software
>> +//  distributed under the License is distributed on an "AS IS" BASIS,
>> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> +//  See the License for the specific language governing permissions and
>> +//  limitations under the License.
>> +//
>> +/////////////////////////////////////////////////////////////////////////
>> ///////
>> +package org.apache.flex.utils
>> +{
>> +    COMPILE::SWF
>> +    {
>> +        import flash.utils.setTimeout;
>> +    }
>> +    
>> +    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
>> +        {
>> +            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);
>> +            }
>> +        }
>> +    }
>> +}
>> \ No newline at end of file
>>
>