hydrogen-web/src/observable/map/BaseObservableMap.js

29 lines
702 B
JavaScript
Raw Normal View History

import {BaseObservable} from "../BaseObservable.js";
2019-02-21 04:18:16 +05:30
export class BaseObservableMap extends BaseObservable {
2019-02-21 04:18:16 +05:30
emitReset() {
for(let h of this._handlers) {
h.onReset();
}
}
// we need batch events, mostly on index based collection though?
// maybe we should get started without?
emitAdd(key, value) {
for(let h of this._handlers) {
h.onAdd(key, value);
}
}
2019-02-24 23:54:28 +05:30
emitUpdate(key, value, ...params) {
2019-02-21 04:18:16 +05:30
for(let h of this._handlers) {
2019-02-24 23:54:28 +05:30
h.onUpdate(key, value, ...params);
2019-02-21 04:18:16 +05:30
}
}
emitRemove(key, value) {
for(let h of this._handlers) {
h.onRemove(key, value);
}
}
}