Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function events(source, type, filter) {
var view = this,
s = new EventStream(filter),
send = function(e, item) {
view.runAsync(null, () => {
if (source === VIEW && prevent(view, type)) {
e.preventDefault();
}
s.receive(eventExtend(view, e, item));
});
},
sources;
if (source === TIMER) {
if (permit(view, 'timer', type)) {
view.timer(send, type);
}
}
export default function(source, type, filter) {
var view = this,
s = new EventStream(filter),
send = function(e, item) {
s.receive(eventExtend(view, e, item));
view.run();
},
sources;
if (source === 'view') {
view._handler.on(type, send);
return s;
}
if (source === 'window') {
if (typeof window !== 'undefined') sources = [window];
} else if (typeof document !== 'undefined') {
sources = document.querySelectorAll(source);
}
prototype.events = function(source, type, filter) {
var view = this,
s = new EventStream(filter),
send = function(e, item) {
s.receive(view.extendEvent(e, item));
view.run();
},
sources;
if (source === 'view') {
this._handler.on(type, send);
return s;
}
if (source === 'window') {
sources = [window];
} else if (typeof document !== 'undefined') {
sources = document.querySelectorAll(source);
}