metamorphosis
Version:
A css variable management library that helps create and organize variables into easily configurable themes.
24 lines (23 loc) • 404 B
JavaScript
class Base {
_dependants = [];
addDep(dep) {
this._dependants.push(dep);
}
removeDep(dep) {
const i = this._dependants.indexOf(dep);
if (i >= 0) {
this._dependants.slice(i, 1);
}
}
_notify() {
for (const dep of this._dependants) {
dep.notify(this);
}
}
notify(..._any) {
throw new Error("Extending class must implement.");
}
}
export {
Base
};