callbag-from-event
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -15,3 +15,5 @@ 'use strict'; | ||
disposed = true; | ||
node.removeEventListener(name, handler, options); | ||
if (node.removeEventListener) node.removeEventListener(name, handler, options); | ||
else if (node.removeListener) node.removeListener(name, handler); | ||
else throw new Error('cannot remove listener from node. No method found.'); | ||
}); | ||
@@ -23,5 +25,7 @@ | ||
node.addEventListener(name, handler, options); | ||
if (node.addEventListener) node.addEventListener(name, handler, options); | ||
else if (node.addListener) node.addListener(name, handler); | ||
else throw new Error('cannot add listener to node. No method found.'); | ||
}; | ||
module.exports = fromEvent; |
@@ -13,3 +13,5 @@ const fromEvent = (node, name, options) => (start, sink) => { | ||
disposed = true; | ||
node.removeEventListener(name, handler, options); | ||
if (node.removeEventListener) node.removeEventListener(name, handler, options); | ||
else if (node.removeListener) node.removeListener(name, handler); | ||
else throw new Error('cannot remove listener from node. No method found.'); | ||
}); | ||
@@ -21,5 +23,7 @@ | ||
node.addEventListener(name, handler, options); | ||
if (node.addEventListener) node.addEventListener(name, handler, options); | ||
else if (node.addListener) node.addListener(name, handler); | ||
else throw new Error('cannot add listener to node. No method found.'); | ||
}; | ||
export default fromEvent; |
{ | ||
"name": "callbag-from-event", | ||
"version": "1.2.1", | ||
"description": "Create a callbag listenable source from events on a DOM node", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/staltz/callbag-from-event.git" | ||
}, | ||
"main": "index.cjs.js", | ||
"module": "index.js", | ||
"types": "types.d.ts", | ||
"scripts": { | ||
"build": "rollup $npm_package_module -o $npm_package_main --f cjs", | ||
"pretest": "npm run build", | ||
"test": "tape test.js", | ||
"prepare": "npm test" | ||
}, | ||
"author": "staltz.com", | ||
"license": "MIT", | ||
"keywords": [ | ||
"callbag" | ||
], | ||
"dependencies": { | ||
"callbag": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"rollup": "^0.67.0", | ||
"tape": "^4.8.0" | ||
} | ||
"name": "callbag-from-event", | ||
"version": "1.3.0", | ||
"description": "Create a callbag listenable source from events on a DOM node", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/staltz/callbag-from-event.git" | ||
}, | ||
"main": "index.cjs.js", | ||
"module": "index.js", | ||
"types": "types.d.ts", | ||
"scripts": { | ||
"build": "rollup $npm_package_module -o $npm_package_main --f cjs", | ||
"pretest": "npm run build", | ||
"test": "tape test.js", | ||
"prepare": "npm test" | ||
}, | ||
"author": "staltz.com", | ||
"license": "MIT", | ||
"keywords": [ | ||
"callbag" | ||
], | ||
"dependencies": { | ||
"callbag": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"rollup": "^0.67.0", | ||
"tape": "^4.8.0" | ||
} | ||
} |
# callbag-from-event | ||
Create a callbag listenable source from events on a DOM node. | ||
Create a callbag listenable source from events on a DOM node or a NodeJS Event Emitter. | ||
@@ -5,0 +5,0 @@ `npm install callbag-from-event` |
9476
237