devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
31 lines (30 loc) • 892 B
JavaScript
/**
* DevExtreme (esm/__internal/core/r1/runtime/inferno/effect.js)
* Version: 25.1.3
* Build date: Wed Jun 25 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
export class InfernoEffect {
constructor(effect, dependency) {
this.dependency = dependency;
this.effect = effect;
this.destroy = effect()
}
update(dependency) {
const currentDependency = this.dependency;
if (dependency) {
this.dependency = dependency
}
if (!dependency || dependency.some(((d, i) => currentDependency[i] !== d))) {
this.dispose();
this.destroy = this.effect()
}
}
dispose() {
if (this.destroy) {
this.destroy()
}
}
}