aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/core
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/core')
-rwxr-xr-xnode_modules/montage/core/core.js14
-rwxr-xr-xnode_modules/montage/core/deserializer.js64
-rwxr-xr-xnode_modules/montage/core/event/mutable-event.js61
-rwxr-xr-xnode_modules/montage/core/promise.js42
-rwxr-xr-xnode_modules/montage/core/serializer.js4
5 files changed, 71 insertions, 114 deletions
diff --git a/node_modules/montage/core/core.js b/node_modules/montage/core/core.js
index 26733c94..9109b772 100755
--- a/node_modules/montage/core/core.js
+++ b/node_modules/montage/core/core.js
@@ -635,16 +635,4 @@ Object.defineProperty(Montage, "callDelegateMethod", {
635 return delegateFunction.apply(delegate, arguments); 635 return delegateFunction.apply(delegate, arguments);
636 } 636 }
637 } 637 }
638}); 638}); \ No newline at end of file
639
640// XXX Does not presently function server-side
641if (typeof window !== "undefined") {
642
643 var EventManager = require("core/event/event-manager").EventManager;
644 EventManager.create().initWithWindow(window);
645
646 // Now that we have a defaultEventManager we can setup the bindings system
647 require("core/event/binding");
648
649}
650
diff --git a/node_modules/montage/core/deserializer.js b/node_modules/montage/core/deserializer.js
index 86cdc560..424a2bc9 100755
--- a/node_modules/montage/core/deserializer.js
+++ b/node_modules/montage/core/deserializer.js
@@ -31,7 +31,7 @@ try {
31 @class module:montage/core/deserializer.Deserializer 31 @class module:montage/core/deserializer.Deserializer
32 @extends module:montage/core/core.Montage 32 @extends module:montage/core/core.Montage
33 */ 33 */
34var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deserializer.Deserializer# */ { 34var Deserializer = exports.Deserializer = Montage.create(Montage, /** @lends module:montage/core/deserializer.Deserializer# */ {
35 _MONTAGE_ID_ATTRIBUTE: {value: "data-montage-id"}, 35 _MONTAGE_ID_ATTRIBUTE: {value: "data-montage-id"},
36 36
37 _objects: {value: null}, 37 _objects: {value: null},
@@ -533,7 +533,7 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri
533 var serialization = this._serialization, 533 var serialization = this._serialization,
534 moduleIds = this._requiredModuleIds = [], 534 moduleIds = this._requiredModuleIds = [],
535 modules = this._modules, 535 modules = this._modules,
536 desc, moduleId, name, objectLocation; 536 desc, moduleId;
537 537
538 for (var label in serialization) { 538 for (var label in serialization) {
539 desc = serialization[label]; 539 desc = serialization[label];
@@ -542,16 +542,8 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri
542 if ("module" in desc) { 542 if ("module" in desc) {
543 moduleId = desc.module; 543 moduleId = desc.module;
544 } else if ("prototype" in desc || "object" in desc) { 544 } else if ("prototype" in desc || "object" in desc) {
545 name = desc.prototype || desc.object 545 Deserializer.parseForModuleAndName(desc.prototype || desc.object, desc);
546 objectLocation = name.split("["); 546 moduleId = desc.module;
547 moduleId = objectLocation[0];
548 desc.module = moduleId;
549 if (objectLocation.length == 2) {
550 desc.name = objectLocation[1].slice(0, -1);
551 } else {
552 this._findObjectNameRegExp.test(moduleId);
553 desc.name = RegExp.$1.replace(this._toCamelCaseRegExp, this._replaceToCamelCase);
554 }
555 } 547 }
556 548
557 if (moduleId && !modules[moduleId] && moduleIds.indexOf(moduleId) == -1) { 549 if (moduleId && !modules[moduleId] && moduleIds.indexOf(moduleId) == -1) {
@@ -559,6 +551,34 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri
559 } 551 }
560 } 552 }
561 }}, 553 }},
554
555 /**
556 Sets the module loader used during deserialization.
557 @function
558 @param {String} name The string representing a module/name pair, such as "my-module[MyModule]".
559 @param {Object} description The description object on which the parseForModuleAndName will populate the module and name properties. [Optional]
560 @returns {Object} The description object with module and name properties populated.
561 */
562 parseForModuleAndName: {
563 value: function(name, desc) {
564 var bracketIndex;
565
566 if (typeof desc === "undefined") {
567 desc = {};
568 }
569 bracketIndex = name.indexOf("[");
570 if (bracketIndex > 0) {
571 desc.module = name.substr(0, bracketIndex);
572 desc.name = name.slice(bracketIndex+1, -1);
573 } else {
574 desc.module = name;
575 Deserializer._findObjectNameRegExp.test(name);
576 desc.name = RegExp.$1.replace(Deserializer._toCamelCaseRegExp, Deserializer._replaceToCamelCase);
577 }
578 return desc;
579 }
580 },
581
562/** 582/**
563 @private 583 @private
564*/ 584*/
@@ -680,23 +700,25 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri
680 hasObject = object != null, 700 hasObject = object != null,
681 counter, 701 counter,
682 descString, 702 descString,
683 objectLocation; 703 objectLocation,
704 bracketIndex;
684 705
685 if ("module" in desc) { 706 if ("module" in desc) {
686 moduleId = desc.module; 707 moduleId = desc.module;
687 objectName = name = desc.name; 708 objectName = name = desc.name;
688 } else if ("prototype" in desc || "object" in desc) { 709 } else if ("prototype" in desc || "object" in desc) {
689 objectLocation = (desc.prototype || desc.object).split("["); 710 bracketIndex = (desc.prototype || desc.object).indexOf("[");
690 // this code is actually only used when canEval == false, 711 // this code is actually only used when canEval == false,
691 // module+name are added when the modules are parsed but it's 712 // module+name are added when the modules are parsed but it's
692 // slow to redo the _serializationString in order to keep the 713 // slow to redo the _serializationString in order to keep the
693 // added module+name when we do JSON.parse(_serializationString) 714 // added module+name when we do JSON.parse(_serializationString)
694 // at canEval == false. 715 // at canEval == false.
695 moduleId = objectLocation[0]; 716 if (bracketIndex > 0) {
696 if (objectLocation.length == 2) { 717 moduleId = name.substr(0, bracketIndex);
697 objectName = name = objectLocation[1].slice(0, -1); 718 objectName = name = name.slice(bracketIndex+1, -1);
698 } else { 719 } else {
699 self._findObjectNameRegExp.test(moduleId); 720 moduleId = name;
721 self._findObjectNameRegExp.test(name);
700 objectName = name = RegExp.$1.replace(self._toCamelCaseRegExp, function(_, g1) { return g1.toUpperCase() }); 722 objectName = name = RegExp.$1.replace(self._toCamelCaseRegExp, function(_, g1) { return g1.toUpperCase() });
701 } 723 }
702 } 724 }
@@ -1142,8 +1164,4 @@ function deserialize(serialization, require, origin) {
1142 return deferred.promise; 1164 return deferred.promise;
1143} 1165}
1144 1166
1145if (typeof exports !== "undefined") { 1167exports.deserialize = deserialize;
1146 exports.Deserializer = Deserializer;
1147 exports.deserialize = deserialize;
1148}
1149
diff --git a/node_modules/montage/core/event/mutable-event.js b/node_modules/montage/core/event/mutable-event.js
index 6f6a0cfd..2ffe2a37 100755
--- a/node_modules/montage/core/event/mutable-event.js
+++ b/node_modules/montage/core/event/mutable-event.js
@@ -6,18 +6,13 @@
6/** 6/**
7 @module montage/core/event/mutable-event 7 @module montage/core/event/mutable-event
8 @requires montage 8 @requires montage
9 @requires montage/core/enum
10 */ 9 */
11var Montage = require("montage").Montage, 10var Montage = require("montage").Montage;
12 Enum = require("core/enum").Enum;
13 11
14// XXX Does not presently function server-side 12// XXX Does not presently function server-side
15if (typeof window !== "undefined") { 13if (typeof window !== "undefined") {
16 14
17var ChangeTypes = exports.ChangeTypes = Enum.create().initWithMembers("MODIFICATION", "ADDITION", "REMOVAL");
18
19var _eventConstructorsByType = {}; 15var _eventConstructorsByType = {};
20var _changeEventConstructor = null;
21var nullDescriptor = {value: null}; 16var nullDescriptor = {value: null};
22 17
23var wrapProperty = function(obj, key) { 18var wrapProperty = function(obj, key) {
@@ -84,44 +79,6 @@ var MutableEvent = exports.MutableEvent = Montage.create(Montage,/** @lends modu
84 } 79 }
85 }, 80 },
86 81
87 /**
88 @function
89 @returns new _changeEventConstructor()
90 */
91 changeEvent: {
92 value: function() {
93 return new _changeEventConstructor();
94 }
95 },
96
97/**
98 @function
99 @param {Event} key TODO
100 @param {Event} minus TODO
101 @returns changeEvent
102 */
103 changeEventForKeyAndValue: {
104 value: function(key, minus) {
105 var changeEvent = new _changeEventConstructor();
106 changeEvent.type = "change@" + key;
107 changeEvent.minus = minus;
108 changeEvent.plus = undefined;
109 changeEvent.propertyChange = ChangeTypes.MODIFICATION;
110 return changeEvent;
111 }
112 },
113
114 /**
115 @function
116 @param {String} plus TODO
117 @returns itself
118 */