diff options
author | Valerio Virgillito | 2012-06-05 00:11:03 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-06-05 00:11:03 -0700 |
commit | f7e4257745ccd44b8d24555f0ef787429d6e472c (patch) | |
tree | 1965bbb794036a8d6184630c188a34f7a6d956e0 /node_modules/montage/core/core.js | |
parent | c1ec69879028220b0c3f11ad6e24035bf527802c (diff) | |
download | ninja-f7e4257745ccd44b8d24555f0ef787429d6e472c.tar.gz |
adding the latest v0.10 montage
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/core/core.js')
-rwxr-xr-x | node_modules/montage/core/core.js | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/node_modules/montage/core/core.js b/node_modules/montage/core/core.js index 80597dce..26733c94 100755 --- a/node_modules/montage/core/core.js +++ b/node_modules/montage/core/core.js | |||
@@ -21,6 +21,7 @@ var ATTRIBUTE_PROPERTIES = "AttributeProperties", | |||
21 | PROTO = "__proto__", | 21 | PROTO = "__proto__", |
22 | VALUE = "value", | 22 | VALUE = "value", |
23 | ENUMERABLE = "enumerable", | 23 | ENUMERABLE = "enumerable", |
24 | DISTINCT = "distinct", | ||
24 | SERIALIZABLE = "serializable", | 25 | SERIALIZABLE = "serializable", |
25 | MODIFY = "modify"; | 26 | MODIFY = "modify"; |
26 | 27 | ||
@@ -63,10 +64,6 @@ Object.defineProperty(Montage, "create", { | |||
63 | 64 | ||
64 | var newObject = Object.create(typeof aPrototype === "undefined" ? this : aPrototype); | 65 | var newObject = Object.create(typeof aPrototype === "undefined" ? this : aPrototype); |
65 | 66 | ||
66 | if (newObject._dependenciesForProperty) { | ||
67 | newObject._dependencyListeners = {}; | ||
68 | } | ||
69 | |||
70 | if (typeof newObject.didCreate === "function") { | 67 | if (typeof newObject.didCreate === "function") { |
71 | newObject.didCreate(); | 68 | newObject.didCreate(); |
72 | } | 69 | } |
@@ -80,7 +77,7 @@ Object.defineProperty(Montage, "create", { | |||
80 | } | 77 | } |
81 | }); | 78 | }); |
82 | 79 | ||
83 | var extendedPropertyAttributes = [SERIALIZABLE, MODIFY]; | 80 | var extendedPropertyAttributes = [SERIALIZABLE]; |
84 | 81 | ||
85 | // Extended property attributes, the property name format is "_" + attributeName + "AttributeProperties" | 82 | // Extended property attributes, the property name format is "_" + attributeName + "AttributeProperties" |
86 | /** | 83 | /** |
@@ -112,13 +109,21 @@ extendedPropertyAttributes.forEach(function(name) { | |||
112 | Object.defineProperty(Montage, "defineProperty", { | 109 | Object.defineProperty(Montage, "defineProperty", { |
113 | 110 | ||
114 | value: function(obj, prop, descriptor) { | 111 | value: function(obj, prop, descriptor) { |
115 | var dependencies = descriptor.dependencies; | 112 | |
113 | var dependencies = descriptor.dependencies, | ||
114 | isValueDescriptor = (VALUE in descriptor); | ||
115 | |||
116 | if (DISTINCT in descriptor && !isValueDescriptor) { | ||
117 | throw ("Cannot use distinct attribute on non-value property '" + prop + "'"); | ||
118 | } | ||
119 | |||
120 | |||
116 | //reset defaults appropriately for framework. | 121 | //reset defaults appropriately for framework. |
117 | if (PROTO in descriptor) { | 122 | if (PROTO in descriptor) { |
118 | descriptor.__proto__ = (VALUE in descriptor ? (typeof descriptor.value === "function" ? _defaultFunctionValueProperty : _defaultObjectValueProperty) : _defaultAccessorProperty); | 123 | descriptor.__proto__ = (isValueDescriptor ? (typeof descriptor.value === "function" ? _defaultFunctionValueProperty : _defaultObjectValueProperty) : _defaultAccessorProperty); |
119 | } else { | 124 | } else { |
120 | var defaults; | 125 | var defaults; |
121 | if (VALUE in descriptor) { | 126 | if (isValueDescriptor) { |
122 | if (typeof descriptor.value === "function") { | 127 | if (typeof descriptor.value === "function") { |
123 | defaults = _defaultFunctionValueProperty; | 128 | defaults = _defaultFunctionValueProperty; |
124 | } else { | 129 | } else { |
@@ -153,10 +158,6 @@ Object.defineProperty(Montage, "defineProperty", { | |||
153 | getAttributeProperties(obj, SERIALIZABLE)[prop] = descriptor.serializable; | 158 | getAttributeProperties(obj, SERIALIZABLE)[prop] = descriptor.serializable; |
154 | } | 159 | } |
155 | 160 | ||
156 | if (MODIFY in descriptor) { | ||
157 | getAttributeProperties(obj, MODIFY)[prop] = descriptor.modify; | ||
158 | } | ||
159 | |||
160 | //this is added to enable value properties with [] or Objects that are new for every instance | 161 | //this is added to enable value properties with [] or Objects that are new for every instance |
161 | if (descriptor.distinct === true && typeof descriptor.value === "object") { | 162 | if (descriptor.distinct === true && typeof descriptor.value === "object") { |
162 | (function(prop,internalProperty, value, obj) { | 163 | (function(prop,internalProperty, value, obj) { |
@@ -587,6 +588,11 @@ Object.defineProperty(Object.prototype, "uuid", { | |||
587 | } | 588 | } |
588 | }); | 589 | }); |
589 | 590 | ||
591 | Montage.defineProperty(Montage, "identifier", { | ||
592 | value: null, | ||
593 | serializable: true | ||
594 | }); | ||
595 | |||
590 | /** | 596 | /** |
591 | Returns true if two objects are equal, otherwise returns false. | 597 | Returns true if two objects are equal, otherwise returns false. |
592 | @function module:montage/core/core.Montage#equals | 598 | @function module:montage/core/core.Montage#equals |
@@ -599,6 +605,8 @@ Object.defineProperty(Montage, "equals", { | |||
599 | } | 605 | } |
600 | }); | 606 | }); |
601 | 607 | ||
608 | |||
609 | |||
602 | /* | 610 | /* |
603 | * If it exists this method calls the method named with the identifier prefix. | 611 | * If it exists this method calls the method named with the identifier prefix. |
604 | * Example: If the name parameter is "shouldDoSomething" and the caller's identifier is "bob", then | 612 | * Example: If the name parameter is "shouldDoSomething" and the caller's identifier is "bob", then |