Merge pull request #445 from elemoine/events
Add on and un methods to ol.Object
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
@exportProperty ol.Object.prototype.changed
|
||||
@exportProperty ol.Object.prototype.get
|
||||
@exportProperty ol.Object.prototype.notify
|
||||
@exportProperty ol.Object.prototype.on
|
||||
@exportProperty ol.Object.prototype.set
|
||||
@exportProperty ol.Object.prototype.setOptions
|
||||
@exportProperty ol.Object.prototype.setValues
|
||||
@exportProperty ol.Object.prototype.un
|
||||
@exportProperty ol.Object.prototype.unbind
|
||||
@exportProperty ol.Object.prototype.unbindAll
|
||||
|
||||
@@ -229,6 +229,17 @@ ol.Object.prototype.notifyInternal_ = function(key) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} type The event type.
|
||||
* @param {Function} listener The listener function.
|
||||
* @param {Object=} opt_scope Object is whose scope to call
|
||||
* the listener.
|
||||
*/
|
||||
ol.Object.prototype.on = function(type, listener, opt_scope) {
|
||||
goog.events.listen(this, type, listener, false, opt_scope);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} key Key.
|
||||
* @param {*} value Value.
|
||||
@@ -292,6 +303,17 @@ ol.Object.prototype.unbind = function(key) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} type The event type.
|
||||
* @param {Function} listener The listener function.
|
||||
* @param {Object=} opt_scope Object is whose scope to call
|
||||
* the listener.
|
||||
*/
|
||||
ol.Object.prototype.un = function(type, listener, opt_scope) {
|
||||
goog.events.unlisten(this, type, listener, false, opt_scope);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Removes all bindings.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user