Repository: flex-asjs Updated Branches: refs/heads/tlf 914e666c7 -> 06f47590c
Added callLater Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/06f47590 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/06f47590 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/06f47590 Branch: refs/heads/tlf Commit: 06f47590cc13434f10f2612d64640bd872ff86bc Parents: 914e666 Author: Added floor to binary search <[email protected]> Authored: Sun Jun 18 13:34:41 2017 +0300 Committer: Added floor to binary search <[email protected]> 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(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/06f47590/frameworks/projects/Core/src/main/flex/CoreClasses.as ---------------------------------------------------------------------- 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; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/06f47590/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/callLater.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/callLater.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/callLater.as new file mode 100644 index 0000000..23af5fe --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/callLater.as @@ -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 +// +// http://www.apache.org/licenses/LICENSE-2.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
