Simplify events and store listeners only in one place

This commit is contained in:
ahocevar
2019-09-04 16:39:32 +02:00
parent d416866108
commit ebfb20440a
52 changed files with 224 additions and 599 deletions
+1 -4
View File
@@ -1,7 +1,6 @@
/**
* @module ol/layer/Heatmap
*/
import {listen} from '../events.js';
import {getChangeEventType} from '../Object.js';
import {createCanvasContext2D} from '../dom.js';
import VectorLayer from './Vector.js';
@@ -83,9 +82,7 @@ class Heatmap extends VectorLayer {
*/
this.gradient_ = null;
listen(this,
getChangeEventType(Property.GRADIENT),
this.handleGradientChanged_, this);
this.addEventListener(getChangeEventType(Property.GRADIENT), this.handleGradientChanged_);
this.setGradient(options.gradient ? options.gradient : DEFAULT_GRADIENT);