
Single Page Application Framworks for Web
Our primary goals are
- Provide a radically faster and widely accessible getting started experience for all front end.
Installation and Getting Started
npm install simple-boot-front
View template engine
-
It's a compiler that takes your declarative components and converts them into efficient JavaScript that surgically updates the DOM.
-
Update view only for parts where the value has changed.
- scope
Module LifeCycle
- onInit(): module load event
- onChangedRender(): change rended in module event
- onInitedChild(): module and child module inited event
- onFinish(): lifecycle finish event
Decorator
- @Sim(): Objects managed by the SimpleBootFront framework
- parameter: SimConfig {schema: string}
@Sim({scheme: 'index'})
export class Index extends Module { }
- @PostConstruct(): Methods that you run for a separate initialization operation after the object is created
@PostConstruct
post(projectService: ProjectService) {
console.log('post Construct and dependency injection')
}
- @After, @Before
fire($event: MouseEvent, view: View<Element>) {
console.log('fire method')
this.data = RandomUtils.random(0, 100);
}
@Before({property: 'fire'})
before(obj: any, protoType: Function) {
console.log('before', obj, protoType)
}
@After({property: 'fire'})
after(obj: any, protoType: Function) {
console.log('after', obj, protoType)
}
- @ExceptionHandler
@ExceptionHandler()
public exception0(e: any) {
console.log('Advice Global exception:', e)
}
Intent event broker
click() {
this.publish(new Intent('layout://info/data?a=wow&aa=zzz', Math.floor(RandomUtils.random(0, 100))));
}
@Sim({scheme: 'layout'})
export class App extends Module {
info = new AppInfo();
constructor() {
super("app-layout-module", {template: html, styleImports:[css]});
}
}
export class AppInfo extends Module {
datas = 'default data';
constructor() {
super("app-info", {template: '<div><h3>info</h3><!--%write(this.datas)%--></div>'});
}
data(i: Intent) {
this.datas = i.data + '->' + i.params.aa
}
}
Reserved key word
- html
- attribute
- [router-outlet]: child module space
- module-event-click: click event
- module-event-change: change event
- module-event-keyup: keyup event
- module-event-keydown: keydown event
- module-link: link event (value change <-> input)
- module-value: value injection
- router-active-class: url === href attribute => class add
- router-link:
- module-event-{{eventName}}-intent-publish: intent publish
- value: ['uri', 'variablename'] or ['uri']
- publish
click event intent publish:
<button class="btn btn-primary" module-event-click-intent-publish="['layout://info/data?a=wow&aa=ppp','makeRandom']">publish data</button>
typing:
<input type="text" module-event-keyup-intent-publish="['layout://info/viewSubscribe?a=wow&aa=vvv']">
data(i: Intent) {
this.datas = i.data + '->' + i.params.aa
}
viewSubscribe(i: Intent<View<HTMLInputElement>>) {
this.datas = i.data?.value + '->' + i.params.aa + '-->' + i.event
}
- css
- /*[module-selector]*/: module Dedicated style
License