🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

rxjs-hooks

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rxjs-hooks - npm Package Compare versions

Comparing version

to
0.4.1

4

dist/cjs/use-event-callback.d.ts
import { Observable, BehaviorSubject } from 'rxjs';
import { RestrictArray, Not } from './type';
export declare type EventCallbackState<EventValue, State, Inputs = void> = [(val: EventValue) => void, [State extends void ? null : State, BehaviorSubject<State | null>, BehaviorSubject<RestrictArray<Inputs> | null>]];
declare type VoidableCallback<EventValue> = EventValue extends void ? () => void : (val: EventValue) => void;
export declare type EventCallbackState<EventValue, State, Inputs = void> = [VoidableCallback<EventValue>, [State extends void ? null : State, BehaviorSubject<State | null>, BehaviorSubject<RestrictArray<Inputs> | null>]];
export declare type ReturnedState<EventValue, State, Inputs> = [EventCallbackState<EventValue, State, Inputs>[0], EventCallbackState<EventValue, State, Inputs>[1][0]];

@@ -9,1 +10,2 @@ export declare type EventCallback<EventValue, State, Inputs> = Not<Inputs extends void ? true : false, (eventSource$: Observable<EventValue>, inputs$: Observable<RestrictArray<Inputs>>, state$: Observable<State>) => Observable<State>, (eventSource$: Observable<EventValue>, state$: Observable<State>) => Observable<State>>;

export declare function useEventCallback<EventValue, State, Inputs>(callback: EventCallback<EventValue, State, Inputs>, initialState: State, inputs: RestrictArray<Inputs>): ReturnedState<EventValue, State, Inputs>;
export {};
import { Observable, BehaviorSubject } from 'rxjs';
import { RestrictArray, Not } from './type';
export declare type EventCallbackState<EventValue, State, Inputs = void> = [(val: EventValue) => void, [State extends void ? null : State, BehaviorSubject<State | null>, BehaviorSubject<RestrictArray<Inputs> | null>]];
declare type VoidableCallback<EventValue> = EventValue extends void ? () => void : (val: EventValue) => void;
export declare type EventCallbackState<EventValue, State, Inputs = void> = [VoidableCallback<EventValue>, [State extends void ? null : State, BehaviorSubject<State | null>, BehaviorSubject<RestrictArray<Inputs> | null>]];
export declare type ReturnedState<EventValue, State, Inputs> = [EventCallbackState<EventValue, State, Inputs>[0], EventCallbackState<EventValue, State, Inputs>[1][0]];

@@ -9,1 +10,2 @@ export declare type EventCallback<EventValue, State, Inputs> = Not<Inputs extends void ? true : false, (eventSource$: Observable<EventValue>, inputs$: Observable<RestrictArray<Inputs>>, state$: Observable<State>) => Observable<State>, (eventSource$: Observable<EventValue>, state$: Observable<State>) => Observable<State>>;

export declare function useEventCallback<EventValue, State, Inputs>(callback: EventCallback<EventValue, State, Inputs>, initialState: State, inputs: RestrictArray<Inputs>): ReturnedState<EventValue, State, Inputs>;
export {};
{
"name": "rxjs-hooks",
"version": "0.4.0",
"version": "0.4.1",
"description": "React hooks for RxJS",

@@ -32,3 +32,3 @@ "module": "dist/esm/index.js",

"coveralls": "^3.0.3",
"fork-ts-checker-webpack-plugin": "^0.5.2",
"fork-ts-checker-webpack-plugin": "^1.0.0",
"happypack": "^5.0.1",

@@ -40,5 +40,5 @@ "html-webpack-plugin": "^3.2.0",

"prettier": "^1.16.4",
"react": "16.8.3",
"react-dom": "16.8.3",
"react-test-renderer": "16.8.3",
"react": "16.8.5",
"react-dom": "16.8.5",
"react-test-renderer": "16.8.5",
"rxjs": "^6.4.0",

@@ -45,0 +45,0 @@ "sinon": "^7.2.4",

@@ -6,4 +6,6 @@ import { useEffect, useState } from 'react'

type VoidableCallback<EventValue> = EventValue extends void ? () => void : (val: EventValue) => void
export type EventCallbackState<EventValue, State, Inputs = void> = [
(val: EventValue) => void,
VoidableCallback<EventValue>,
[State extends void ? null : State, BehaviorSubject<State | null>, BehaviorSubject<RestrictArray<Inputs> | null>]

@@ -48,3 +50,5 @@ ]

const [state, setState] = useState(initialValue)
const [returnedCallback, setEventCallback] = useState<(val: EventValue) => void>(() => noop)
const [returnedCallback, setEventCallback] = useState<VoidableCallback<EventValue>>(
() => noop as VoidableCallback<EventValue>,
)
const [state$] = useState(stateSubject$)

@@ -63,3 +67,3 @@ const [inputs$] = useState(inputSubject$)

setState(initialValue)
setEventCallback(() => eventCallback)
setEventCallback(() => eventCallback as VoidableCallback<EventValue>)
let value$: Observable<State>

@@ -66,0 +70,0 @@

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