mframejs
Version:
simple framework
28 lines • 1.08 kB
JavaScript
import { BindingEngine } from '../binding/exported';
import { Cache } from './cache';
import { ContainerBehavior } from '../container/exported';
export function connectBehavior(expressionValue, _class) {
if (expressionValue.indexOf('&') !== -1) {
let x = Cache.expressionMap.get(expressionValue);
if (!x) {
const tokens = BindingEngine.tokenize(expressionValue);
x = {};
x.ast = BindingEngine.generateAST(tokens);
Cache.expressionMap.set(expressionValue, {
ast: x.ast,
tokens: tokens
});
}
const behaviors = BindingEngine.getBehavior(x.ast);
if (behaviors) {
behaviors.forEach((behavior) => {
const x = ContainerBehavior.findBehavior(behavior.name);
if (x) {
let curBehavior = new x(_class, behavior.args);
curBehavior = curBehavior;
}
});
}
}
}
//# sourceMappingURL=connectBehavior.js.map