@effection/events
Advanced tools
Comparing version 2.0.0-preview.2-b660659 to 2.0.0-preview.3-698bf2f
# Changelog | ||
## 2.0.0-preview.3 | ||
### Minor Changes | ||
- 3ca4cd4: Change `on` to return subscribable, rather than taking scope | ||
### Patch Changes | ||
- Updated dependencies [3ca4cd4] | ||
- Updated dependencies [3ca4cd4] | ||
- Updated dependencies [3ca4cd4] | ||
- Updated dependencies [2bf5ef4] | ||
- Updated dependencies [3ca4cd4] | ||
- effection@2.0.0-preview.4 | ||
- @effection/subscription@2.0.0-preview.3 | ||
## 2.0.0-preview.2 | ||
@@ -4,0 +20,0 @@ |
@@ -49,3 +49,3 @@ 'use strict'; | ||
function on(source, name) { | ||
return subscription.createSubscribable(function (publish) { | ||
return subscription.createStream(function (publish) { | ||
return function* () { | ||
@@ -52,0 +52,0 @@ var listener = function listener() { |
@@ -1,2 +0,2 @@ | ||
"use strict";var n=require("@effection/subscription");function r(n){return"function"==typeof n.addEventListener}function t(n,t,e){r(n)?n.addEventListener(t,e):n.on(t,e)}function e(n,t,e){r(n)?n.removeEventListener(t,e):n.off(t,e)}function o(n,r){return function(o){return function(i){var u=function(){for(var n=arguments.length,r=new Array(n),t=0;t<n;t++)r[t]=arguments[t];i(r)};o.ensure((function(){e(n,r,u)})),t(n,r,u)}}}exports.on=function(r,o){return n.createSubscribable((function(n){return function*(){var i=function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];return n(t)};try{t(r,o,i),yield}finally{e(r,o,i)}}}))},exports.once=o,exports.throwOnErrorEvent=function(n,r){return n.spawn((function*(){throw(yield o(r,"error"))[0]}))}; | ||
"use strict";var n=require("@effection/subscription");function r(n){return"function"==typeof n.addEventListener}function t(n,t,e){r(n)?n.addEventListener(t,e):n.on(t,e)}function e(n,t,e){r(n)?n.removeEventListener(t,e):n.off(t,e)}function o(n,r){return function(o){return function(i){var u=function(){for(var n=arguments.length,r=new Array(n),t=0;t<n;t++)r[t]=arguments[t];i(r)};o.ensure((function(){e(n,r,u)})),t(n,r,u)}}}exports.on=function(r,o){return n.createStream((function(n){return function*(){var i=function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];return n(t)};try{t(r,o,i),yield}finally{e(r,o,i)}}}))},exports.once=o,exports.throwOnErrorEvent=function(n,r){return n.spawn((function*(){throw(yield o(r,"error"))[0]}))}; | ||
//# sourceMappingURL=events.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
import { createSubscribable } from '@effection/subscription'; | ||
import { createStream } from '@effection/subscription'; | ||
@@ -47,3 +47,3 @@ function isEventTarget(target) { | ||
function on(source, name) { | ||
return createSubscribable(function (publish) { | ||
return createStream(function (publish) { | ||
return function* () { | ||
@@ -50,0 +50,0 @@ var listener = function listener() { |
@@ -1,3 +0,3 @@ | ||
import { Subscribable } from '@effection/subscription'; | ||
import { Stream } from '@effection/subscription'; | ||
import { EventSource } from './event-source'; | ||
export declare function on<T extends Array<unknown> = unknown[]>(source: EventSource, name: string): Subscribable<T, void>; | ||
export declare function on<T extends Array<unknown> = unknown[]>(source: EventSource, name: string): Stream<T, void>; |
{ | ||
"name": "@effection/events", | ||
"version": "2.0.0-preview.2-b660659", | ||
"version": "2.0.0-preview.3-698bf2f", | ||
"description": "Helpers for listening to events with effection", | ||
@@ -24,4 +24,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"effection": "^2.0.0-preview.3", | ||
"@effection/subscription": "^2.0.0-preview.2" | ||
"effection": "^2.0.0-preview.4", | ||
"@effection/subscription": "^2.0.0-preview.3" | ||
}, | ||
@@ -31,2 +31,3 @@ "devDependencies": { | ||
"@types/node": "^12.7.11", | ||
"@effection/mocha": "2.0.0-preview.2", | ||
"expect": "^25.4.0", | ||
@@ -33,0 +34,0 @@ "mocha": "^7.1.1", |
@@ -1,7 +0,7 @@ | ||
import { createSubscribable, Subscribable } from '@effection/subscription'; | ||
import { createStream, Stream } from '@effection/subscription'; | ||
import { EventSource, addListener, removeListener } from './event-source'; | ||
export function on<T extends Array<unknown> = unknown[]>(source: EventSource, name: string): Subscribable<T, void> { | ||
return createSubscribable((publish) => function*() { | ||
export function on<T extends Array<unknown> = unknown[]>(source: EventSource, name: string): Stream<T, void> { | ||
return createStream((publish) => function*() { | ||
let listener = (...args: T) => publish(args); | ||
@@ -8,0 +8,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
26990
8