equal
deleted
inserted
replaced
63 } |
63 } |
64 |
64 |
65 emit "preamble:widget-base-class" { |
65 emit "preamble:widget-base-class" { |
66 || |
66 || |
67 class Widget { |
67 class Widget { |
|
68 offset = 0; |
|
69 frequency = 10; /* FIXME arbitrary default max freq. Obtain from config ? */ |
68 constructor(elt_id,args,indexes,members){ |
70 constructor(elt_id,args,indexes,members){ |
|
71 this.element_id = elt_id; |
69 this.element = id(elt_id); |
72 this.element = id(elt_id); |
70 this.args = args; |
73 this.args = args; |
71 this.indexes = indexes; |
74 this.indexes = indexes; |
72 this.offset = 0; |
|
73 Object.keys(members).forEach(prop => this[prop]=members[prop]); |
75 Object.keys(members).forEach(prop => this[prop]=members[prop]); |
74 } |
76 } |
|
77 |
75 unsub(){ |
78 unsub(){ |
76 /* remove subsribers */ |
79 /* remove subsribers */ |
77 for(let index of this.indexes){ |
80 for(let index of this.indexes){ |
78 let idx = index + this.offset; |
81 let idx = index + this.offset; |
79 subscribers[idx].delete(this); |
82 subscribers[idx].delete(this); |