Replace goog.events.Event/EventTarget system with our own

This also removes goog.events.listen, goog.events.unlisten,
goog.events.unlistenByKey and goog.events.BrowserEvent.
This commit is contained in:
Andreas Hocevar
2016-01-29 16:29:46 +01:00
parent d87482e415
commit 3f2d79b7fe
110 changed files with 1143 additions and 733 deletions

View File

@@ -2,8 +2,8 @@ goog.provide('ol.reproj.Image');
goog.provide('ol.reproj.ImageFunctionType');
goog.require('goog.asserts');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.ImageBase');
goog.require('ol.ImageState');
goog.require('ol.extent');
@@ -102,7 +102,7 @@ ol.reproj.Image = function(sourceProj, targetProj,
/**
* @private
* @type {goog.events.Key}
* @type {ol.events.Key|null}
*/
this.sourceListenerKey_ = null;
@@ -183,8 +183,8 @@ ol.reproj.Image.prototype.load = function() {
sourceState == ol.ImageState.ERROR) {
this.reproject_();
} else {
this.sourceListenerKey_ = this.sourceImage_.listen(
goog.events.EventType.CHANGE, function(e) {
this.sourceListenerKey_ = ol.events.listen(this.sourceImage_,
ol.events.EventType.CHANGE, function(e) {
var sourceState = this.sourceImage_.getState();
if (sourceState == ol.ImageState.LOADED ||
sourceState == ol.ImageState.ERROR) {
@@ -204,6 +204,6 @@ ol.reproj.Image.prototype.load = function() {
ol.reproj.Image.prototype.unlistenSource_ = function() {
goog.asserts.assert(this.sourceListenerKey_,
'this.sourceListenerKey_ should not be null');
goog.events.unlistenByKey(this.sourceListenerKey_);
ol.events.unlistenByKey(this.sourceListenerKey_);
this.sourceListenerKey_ = null;
};

View File

@@ -2,8 +2,8 @@ goog.provide('ol.reproj.Tile');
goog.provide('ol.reproj.TileFunctionType');
goog.require('goog.asserts');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('goog.math');
goog.require('goog.object');
goog.require('ol.Tile');
@@ -97,7 +97,7 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
/**
* @private
* @type {Array.<goog.events.Key>}
* @type {Array.<ol.events.Key>}
*/
this.sourcesListenerKeys_ = null;
@@ -297,13 +297,13 @@ ol.reproj.Tile.prototype.load = function() {
leftToLoad++;
var sourceListenKey;
sourceListenKey = tile.listen(goog.events.EventType.CHANGE,
sourceListenKey = ol.events.listen(tile, ol.events.EventType.CHANGE,
function(e) {
var state = tile.getState();
if (state == ol.TileState.LOADED ||
state == ol.TileState.ERROR ||
state == ol.TileState.EMPTY) {
goog.events.unlistenByKey(sourceListenKey);
ol.events.unlistenByKey(sourceListenKey);
leftToLoad--;
goog.asserts.assert(leftToLoad >= 0,
'leftToLoad should not be negative');
@@ -337,6 +337,6 @@ ol.reproj.Tile.prototype.load = function() {
ol.reproj.Tile.prototype.unlistenSources_ = function() {
goog.asserts.assert(this.sourcesListenerKeys_,
'this.sourcesListenerKeys_ should not be null');
this.sourcesListenerKeys_.forEach(goog.events.unlistenByKey);
this.sourcesListenerKeys_.forEach(ol.events.unlistenByKey);
this.sourcesListenerKeys_ = null;
};