|
@@ -32,17 +32,19 @@ define(function () {
|
|
|
|
|
|
/* Method not implemented handlers */
|
|
/* Method not implemented handlers */
|
|
|
|
|
|
- function installNewSelector(selector, targetClasses) {
|
|
|
|
- var jsSelector = st2js(selector);
|
|
|
|
- jsSelectors.push(jsSelector);
|
|
|
|
- var fn = createHandler(selector);
|
|
|
|
- installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
|
|
|
|
- targetClasses.forEach(function (target) {
|
|
|
|
- installJSMethod(target.fn.prototype, jsSelector, fn);
|
|
|
|
|
|
+ function installNewSelectors (newSelectors, targetClasses) {
|
|
|
|
+ newSelectors.forEach(function (selector) {
|
|
|
|
+ var jsSelector = st2js(selector);
|
|
|
|
+ jsSelectors.push(jsSelector);
|
|
|
|
+ var fn = createHandler(selector);
|
|
|
|
+ installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
|
|
|
|
+ targetClasses.forEach(function (target) {
|
|
|
|
+ installJSMethod(target.fn.prototype, jsSelector, fn);
|
|
|
|
+ });
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- this.installNewSelector = installNewSelector;
|
|
|
|
|
|
+ this.installNewSelectors = installNewSelectors;
|
|
|
|
|
|
/* Dnu handler method */
|
|
/* Dnu handler method */
|
|
|
|
|
|
@@ -54,14 +56,13 @@ define(function () {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
- selectors.forEach(function (selector) {
|
|
|
|
- installNewSelector(selector, []);
|
|
|
|
- });
|
|
|
|
|
|
+ installNewSelectors(selectors, []);
|
|
}
|
|
}
|
|
|
|
|
|
RuntimeClassesBrik.deps = ["event", "dnu", "behaviors", "classes"];
|
|
RuntimeClassesBrik.deps = ["event", "dnu", "behaviors", "classes"];
|
|
function RuntimeClassesBrik (brikz, st) {
|
|
function RuntimeClassesBrik (brikz, st) {
|
|
var jsSelectors = brikz.dnu.jsSelectors;
|
|
var jsSelectors = brikz.dnu.jsSelectors;
|
|
|
|
+ var installNewSelectors = brikz.dnu.installNewSelectors;
|
|
var traitsOrClasses = brikz.behaviors.traitsOrClasses;
|
|
var traitsOrClasses = brikz.behaviors.traitsOrClasses;
|
|
var wireKlass = brikz.classes.wireKlass;
|
|
var wireKlass = brikz.classes.wireKlass;
|
|
var emit = brikz.event.emit;
|
|
var emit = brikz.event.emit;
|
|
@@ -79,6 +80,10 @@ define(function () {
|
|
return detachedRootClasses;
|
|
return detachedRootClasses;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ emit.selectorsAdded = function (newSelectors) {
|
|
|
|
+ installNewSelectors(newSelectors, detachedRootClasses);
|
|
|
|
+ };
|
|
|
|
+
|
|
/* Initialize a class in its class hierarchy. Handle both classes and
|
|
/* Initialize a class in its class hierarchy. Handle both classes and
|
|
metaclasses. */
|
|
metaclasses. */
|
|
|
|
|
|
@@ -163,10 +168,8 @@ define(function () {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- RuntimeMethodsBrik.deps = ["event", "dnu", "runtimeClasses"];
|
|
|
|
|
|
+ RuntimeMethodsBrik.deps = ["event"];
|
|
function RuntimeMethodsBrik (brikz, st) {
|
|
function RuntimeMethodsBrik (brikz, st) {
|
|
- var installNewSelector = brikz.dnu.installNewSelector;
|
|
|
|
- var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
|
|
|
|
var emit = brikz.event.emit;
|
|
var emit = brikz.event.emit;
|
|
|
|
|
|
emit.behaviorMethodAdded = function (method, klass) {
|
|
emit.behaviorMethodAdded = function (method, klass) {
|
|
@@ -174,13 +177,6 @@ define(function () {
|
|
propagateMethodChange(klass, method, klass);
|
|
propagateMethodChange(klass, method, klass);
|
|
};
|
|
};
|
|
|
|
|
|
- emit.selectorsAdded = function (newSelectors) {
|
|
|
|
- var targetClasses = detachedRootClasses();
|
|
|
|
- newSelectors.forEach(function (jsSelector) {
|
|
|
|
- installNewSelector(jsSelector, targetClasses);
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
emit.behaviorMethodRemoved = function (method, klass) {
|
|
emit.behaviorMethodRemoved = function (method, klass) {
|
|
delete klass.fn.prototype[method.jsSelector];
|
|
delete klass.fn.prototype[method.jsSelector];
|
|
propagateMethodChange(klass, method, null);
|
|
propagateMethodChange(klass, method, null);
|