I like proposal with:
#name- invoke a handler by namecatch name {...}- define a handler
It solved many situations, but i think can be improved with panic and return state, like in proposal:
func returnError() error {
return errors.New()
| {"lastUpload":"2018-09-04T08:41:41.171Z","extensionVersion":"v3.1.2"} |
| export interface VirtualTableConfig { | |
| column?: Array<VirtualTableColumn>; // if config not provide will be auto generate column | |
| filter?: boolean; // default false | |
| header?: boolean; // default true | |
| } | |
| export interface VirtualTableColumn { | |
| name?: string; // Label for field, if absent will be use key | |
| key: string; // Uniq key for filed, | |
| func?: (item: VirtualTableItem) => any; // function for get value from dataSource item | |
| comp?: (a: any, b: any) => number; // function for compare two item, depend from `func` function |
| @Input() itemSize = 25; // for itemHeight | |
| @Input() dataSource: Observable<Array<VirtualTableItem | number | string | boolean>>; | |
| @Input() filterPlaceholder = 'Filter'; | |
| @Input() dataSetEmptyPlaceholder = 'Data is empty'; | |
| @Input() config: VirtualTableConfig; |
| let getResult = () => { | |
| const hashMap = {} | |
| document.querySelectorAll(".list-group-contest-item").forEach((item) => { | |
| const auth = item.querySelector(".has-candidate .contest-item-candidate > a"); | |
| if (auth) { | |
| const url = auth.href | |
| hashMap[auth.textContent] = hashMap[auth.textContent] ? [hashMap[auth.textContent][0], hashMap[auth.textContent][1] + 1] : [auth.textContent, 1] | |
| } | |
| }); | |
| return Object.keys(hashMap).map((e) => hashMap[e]).sort((e, e2) => e2[1] - e[1]) |
I like proposal with:
#name - invoke a handler by namecatch name {...} - define a handlerIt solved many situations, but i think can be improved with panic and return state, like in proposal:
func returnError() error {
return errors.New()
| import { bootstrap } from 'revact'; | |
| bootstrap('#app', () => ({ | |
| tag: "div", | |
| textValue: "Hello World!", | |
| })) |
| import { bootstrap, rValue } from 'revact'; | |
| bootstrap('#app', () => { | |
| const counter = rValue(0) | |
| return { | |
| tag: "div", | |
| textValue: counter, | |
| listeners: { | |
| click: () => { | |
| counter.value +=1 |
| import { bootstrap, Component, rValue, createComponent } from 'revact'; | |
| class Counter extends Component { | |
| reactive = { | |
| counter: rValue(0) | |
| } | |
| template = { | |
| tag: "span", | |
| textValue: this.reactive.counter, |
| import { bootstrap, Component, rValue, createComponent, createRouter, Router, rList } from 'revact'; | |
| class Counter extends Component { | |
| reactive = { | |
| counter: rValue(0) | |
| } | |
| template = { | |
| tag: "span", | |
| textValue: this.reactive.counter, |
| render() { | |
| const cond = true; | |
| return { | |
| <div> | |
| { cond ? <Component/> : (null) } | |
| </div> | |
| } | |
| } |