@effection/events
Advanced tools
Comparing version 0.7.3-b1952e1 to 0.7.3-db11b3f
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
export declare type EventSource = EventEmitter | EventTarget; | ||
export declare type EventSource = EventEmitter | DOMEventTarget; | ||
export declare function addListener(source: EventSource, name: string, listener: () => void): void; | ||
export declare function removeListener(source: EventSource, name: string, listener: () => void): void; | ||
interface DOMEventTarget { | ||
addEventListener: EventTarget["addEventListener"]; | ||
removeEventListener: EventTarget["removeEventListener"]; | ||
} | ||
export {}; |
@@ -31,2 +31,3 @@ 'use strict'; | ||
function* once(source, eventName) { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
var onceListener = function onceListener() {}; | ||
@@ -33,0 +34,0 @@ |
@@ -29,2 +29,3 @@ import { createSubscription } from '@effection/subscription'; | ||
function* once(source, eventName) { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
var onceListener = function onceListener() {}; | ||
@@ -31,0 +32,0 @@ |
{ | ||
"name": "@effection/events", | ||
"version": "0.7.3-b1952e1", | ||
"version": "0.7.3-db11b3f", | ||
"description": "Helpers for listening to events with effection", | ||
@@ -9,3 +9,3 @@ "main": "dist/index.js", | ||
"repository": "https://github.com/thefrontside/bigtest.git", | ||
"author": "Frontside Engineering <engineering@frontside.io>", | ||
"author": "Frontside Engineering <engineering@frontside.com>", | ||
"license": "MIT", | ||
@@ -18,3 +18,3 @@ "files": [ | ||
"scripts": { | ||
"lint": "echo [skip @effection/events]", | ||
"lint": "eslint '{src,tests}/**/*.ts'", | ||
"test": "mocha -r ts-node/register test/**/*.test.ts", | ||
@@ -25,2 +25,3 @@ "prepack": "tsdx build --tsconfig tsconfig.dist.json", | ||
"dependencies": { | ||
"effection": "^0.6.4", | ||
"@effection/subscription": "^0.7.1" | ||
@@ -37,5 +38,2 @@ }, | ||
}, | ||
"peerDependencies": { | ||
"effection": "^0.6.4" | ||
}, | ||
"volta": { | ||
@@ -42,0 +40,0 @@ "node": "12.16.0", |
import { EventEmitter } from 'events'; | ||
export type EventSource = EventEmitter | EventTarget | ||
export type EventSource = EventEmitter | DOMEventTarget | ||
function isEventTarget(target: EventSource): target is EventTarget { | ||
return typeof (target as EventTarget).addEventListener === 'function'; | ||
function isEventTarget(target: EventSource): target is DOMEventTarget { | ||
return typeof (target as DOMEventTarget).addEventListener === 'function'; | ||
} | ||
@@ -24,1 +24,6 @@ | ||
} | ||
interface DOMEventTarget { | ||
addEventListener: EventTarget["addEventListener"]; | ||
removeEventListener: EventTarget["removeEventListener"]; | ||
} |
@@ -9,2 +9,3 @@ import { Operation } from 'effection'; | ||
export function *once(source: EventSource, eventName: string): Operation { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
let onceListener = () => {}; | ||
@@ -11,0 +12,0 @@ try { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25148
237
+ Addedeffection@^0.6.4