2020-08-05 22:08:55 +05:30
|
|
|
/*
|
|
|
|
Copyright 2020 Bruno Windels <bruno@windels.cloud>
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2020-04-21 00:56:39 +05:30
|
|
|
import {BaseObservable} from "../BaseObservable.js";
|
2019-02-21 04:18:16 +05:30
|
|
|
|
2020-04-21 00:56:39 +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);
|
|
|
|
}
|
|
|
|
}
|
2020-11-05 16:30:17 +05:30
|
|
|
|
|
|
|
[Symbol.iterator]() {
|
|
|
|
throw new Error("unimplemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
get size() {
|
|
|
|
throw new Error("unimplemented");
|
|
|
|
}
|
2019-02-21 04:18:16 +05:30
|
|
|
}
|