Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 29x 29x 29x 29x 29x 29x 15x 15x 15x 15x 15x 15x 15x 15x | import { DOM } from './dom';
import { View, ViewController } from '../view/exported';
import { IElement } from '../interface/exported';
import { DebounceBehavior, ThrottleBehavior, SignalBehavior, TriggerBehavior } from '../behavior/exported';
// built in attributes
import {
IfAttribute,
ValueAttribute,
DelgateEventsAttribute,
TriggerEventsAttribute,
RepeatAttribute,
MiscAttributes,
CssAttribute,
ModelAttribute
} from '../attribute/exported';
import { createBindingContext } from '../binding/exported';
/**
* Main framework class, this is returned in the configure function
*
*/
export class MF {
private node: Node;
private app: IElement;
public count = 0;
private $view: ViewController;
constructor() {
// polyfill IE11
if (!(DOM.window as any).Reflect) {
(DOM.window as any).Reflect = Object;
}
// register built in attributes/elements
this.register(
ValueAttribute,
IfAttribute,
DelgateEventsAttribute,
RepeatAttribute,
MiscAttributes,
CssAttribute,
ModelAttribute,
TriggerEventsAttribute,
SignalBehavior,
ThrottleBehavior,
DebounceBehavior,
TriggerBehavior);
}
/**
* sets node and app
*
*/
public setRootApp(app: IElement) {
this.app = app;
// return this instance
return this;
}
/**
* starts application
*
*/
public async start(node: Node) {
this.node = node;
// set framework to main node
this.$view = new ViewController(node, null);
View.parseAndCreateElement(this.app, this.node, createBindingContext(this), null, this.$view);
}
/**
* register new custom attributes, custom elements
*
*/
public register(..._class: any[]) {
// does not need to do anything really
// by using them the decorator will kick in and they will be registered
}
}
|