Add ol.Object#onOnce

This commit is contained in:
Tom Payne
2013-04-25 16:54:02 +02:00
parent 09fe09e42b
commit e8109919e9
2 changed files with 13 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
@exportProperty ol.Object.prototype.get
@exportProperty ol.Object.prototype.notify
@exportProperty ol.Object.prototype.on
@exportProperty ol.Object.prototype.onOnce
@exportProperty ol.Object.prototype.set
@exportProperty ol.Object.prototype.setOptions
@exportProperty ol.Object.prototype.setValues

View File

@@ -235,6 +235,18 @@ ol.Object.prototype.on = function(type, listener, opt_scope) {
};
/**
* @param {string} type The event type.
* @param {Function} listener The listener function.
* @param {Object=} opt_scope Object is whose scope to call
* the listener.
* @return {?number} Unique key for the listener.
*/
ol.Object.prototype.onOnce = function(type, listener, opt_scope) {
return goog.events.listenOnce(this, type, listener, false, opt_scope);
};
/**
* @param {string} key Key.
* @param {*} value Value.