diff src/djol/listen.js @ 10:8705103f074f

Слияние
author cin
date Mon, 21 Aug 2017 18:03:00 +0300
parents f0035923ff3e
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/djol/listen.js	Mon Aug 21 18:03:00 2017 +0300
@@ -0,0 +1,22 @@
+define(["ol"], function(ol) {
+
+    var listen = function(target, event, callback) {
+        var key = target.on(event, callback);
+        return {
+            remove : function() {
+                ol.Observable.unByKey(key);
+            }
+        };
+    };
+
+    listen.once =  function(target, event, callback) {
+        var key = target.once(event, callback);
+        return {
+            remove : function() {
+                ol.Observable.unByKey(key);
+            }
+        };
+    };
+
+    return listen;
+});
\ No newline at end of file