view src/djol/listen.js @ 25:c2a7d21175ce

Added css injection plugin, implab/dom/css!<css-path>
author cin
date Fri, 08 Dec 2017 04:31:43 +0300
parents f0035923ff3e
children
line wrap: on
line source

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;
});