forked from jabbany/CommentCoreLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunction.js
More file actions
56 lines (52 loc) · 1.05 KB
/
Function.js
File metadata and controls
56 lines (52 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/** These are all defined in the global namespace **/
function trace(msg){
__trace(msg, 'log');
}
function load(library, onComplete){
var libname = "";
switch(library){
default:
break;
};
if(libname !== ""){
try{
require("libraries/" + libname + ".js");
}catch(e){
trace("Error: Import script failed.");
}
}
if(onComplete)
onComplete();
};
function clone(a){
if(null === a || "object" != typeof a)
return a;
/** Call method's own clone if possible **/
if(a.hasOwnProperty("clone") || typeof a["clone"] === "function"){
return a.clone();
}
/** Perform a shallow clone */
var b = {};
b.constructor = a.constructor;
b.prototype = a.prototype;
for(var x in a){
b[x] = a[x];
}
return b;
};
function foreach(dtype, f){
if(null === dtype || "object" != typeof dtype)
return;
/** DisplayObjects do not have any enumerable properties **/
if(dtype instanceof Display.DisplayObject){
return;
}
/** Iterates through object **/
for(var x in dtype){
if(dtype.hasOwnProperty(x)){
f(x, dtype[x]);
}
}
return;
};
var none = null;