forked from playcanvas/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscope-space.js
More file actions
44 lines (34 loc) · 1.14 KB
/
scope-space.js
File metadata and controls
44 lines (34 loc) · 1.14 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
pc.extend(pc, function () {
'use strict';
var ScopeSpace = function (name) {
// Store the name
this.name = name;
// Create the empty tables
this.variables = {};
this.namespaces = {};
};
ScopeSpace.prototype = {
resolve: function(name) {
// Check if the ScopeId already exists
if (this.variables.hasOwnProperty(name) === false) {
// Create and add to the table
this.variables[name] = new pc.ScopeId(name);
}
// Now return the ScopeId instance
return this.variables[name];
},
getSubSpace: function(name) {
// Check if the nested namespace already exists
if (this.namespaces.hasOwnProperty(name) === false) {
// Create and add to the table
this.namespaces[name] = new pc.ScopeSpace(name);
logDEBUG("Added ScopeSpace: " + name);
}
// Now return the ScopeNamespace instance
return this.namespaces[name];
}
};
return {
ScopeSpace: ScopeSpace
};
}());