Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var e = parse(event);
var el = this.el;
var obj = this.obj;
var name = e.name;
var method = method || 'on' + name;
var args = [].slice.call(arguments, 2);
// callback
function cb(){
var a = [].slice.call(arguments).concat(args);
obj[method].apply(obj, a);
}
// bind
if (e.selector) {
cb = delegate.bind(el, e.selector, name, cb);
} else {
events.bind(el, name, cb);
}
// subscription for unbinding
this.sub(name, method, cb);
return cb;
};
this.excepts = [];
this.ids = {};
var self = this;
// localstorage namespace
this.namespace = options.namespace || 'remember:';
// pull from storage
this.pull();
this.oninput = bind(this, this.input);
this.onselect = bind(this, this.select);
// bindings
delegate.bind(document, inputs, 'input', this.oninput);
delegate.bind(document, buttons, 'click', this.onselect);
}
var e = parse(event);
var el = this.el;
var obj = this.obj;
var name = e.name;
var method = method || 'on' + name;
var args = [].slice.call(arguments, 2);
// callback
function cb(){
var a = [].slice.call(arguments).concat(args);
obj[method].apply(obj, a);
}
// bind
if (e.selector) {
cb = delegate.bind(el, e.selector, name, cb);
} else {
events.bind(el, name, cb);
}
// subscription for unbinding
this.sub(name, method, cb);
return cb;
};
options = options || {};
this.excepts = [];
this.ids = {};
var self = this;
// localstorage namespace
this.namespace = options.namespace || 'remember:';
// pull from storage
this.pull();
this.oninput = bind(this, this.input);
this.onselect = bind(this, this.select);
// bindings
delegate.bind(document, inputs, 'input', this.oninput);
delegate.bind(document, buttons, 'click', this.onselect);
}
options = options || {};
this.excepts = [];
this.ids = {};
var self = this;
// localstorage namespace
this.namespace = options.namespace || 'remember:';
// pull from storage
this.pull();
this.oninput = bind(this, this.input);
this.onselect = bind(this, this.select);
// bindings
delegate.bind(document, inputs, 'input', this.oninput);
delegate.bind(document, buttons, 'click', this.onselect);
}
console.log(e.target);
if (++n >= 3) {
console.log('unbind');
delegate.unbind(uls[0], 'click', fn, false);
}
}, false);
var fn2 = delegate.bind(uls[1], 'li a', 'click', function(e){
console.log(e.target);
if (++n >= 8) {
console.log('unbind');
delegate.unbind(uls[1], 'click', fn2, false);
}
}, false);
var fn3 = delegate.bind(uls[2], 'li', 'click', function(e){
console.log(e.target);
if (++n >= 8) {
console.log('unbind');
delegate.unbind(uls[2], 'click', fn2, false);
}
}, false);
View.prototype.bind = function(str, method){
var parts = str.split(' ');
var event = parts.shift();
var selector = parts.join(' ');
var meth = this[method];
if (!meth) throw new TypeError('method "' + method + '" is not defined');
var fn = delegate.bind(this.el, selector, event, meth.bind(this));
this.bindings[str] = fn;
};
return this.forEach(function (el) {
fn._delegate = delegate.bind(el, selector, event, fn, capture);
});
}
List.prototype.on = function(event, selector, fn, capture){
if ('string' == typeof selector) {
for (var i = 0; i < this.els.length; ++i) {
fn._delegate = delegate.bind(this.els[i], selector, event, fn, capture);
}
return this;
}
capture = fn;
fn = selector;
for (var i = 0; i < this.els.length; ++i) {
events.bind(this.els[i], event, fn, capture);
}
return this;
};
Events.prototype.bind = function(el, event, fn) {
if('string' == typeof el) fn = event, event = el, el = this.el;
this._events = this._events || {};
var events = this._events,
match = event.match(splitter),
eventName = match[1],
selector = match[2];
fn = ('string' == typeof fn) ? this[fn] : fn;
fn = fn.bind(this);
if(selector === '') Event.bind(el, eventName, fn);
else fn = Delegate.bind(el, selector, eventName, fn);
if(!events[eventName]) events[eventName] = [];
events[eventName].push(fn);
return this;
};