Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@equinor/fusion-observable

Package Overview
Dependencies
Maintainers
4
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/fusion-observable - npm Package Compare versions

Comparing version 4.0.1 to 6.0.0

2

dist/esm/react/useObservableInput.js

@@ -8,4 +8,4 @@ import { useMemo } from 'react';

export const useObservableInputState = (input, initial) => {
return useObservableState(useObservableInput(input), initial);
return useObservableState(useObservableInput(input), { initial }).next;
};
//# sourceMappingURL=useObservableInput.js.map
import { useObservableSelector } from './useObservableSelector';
import { useObservableState } from './useObservableState';
export const useObservableSelectorState = (subject, selector, initial, compare) => useObservableState(useObservableSelector(subject, selector, compare), initial);
export const useObservableSelectorState = (subject, selector, initial, compare) => useObservableState(useObservableSelector(subject, selector, compare), { initial }).next;
//# sourceMappingURL=useObservableSelectorState.js.map

@@ -1,10 +0,13 @@

import { useState } from 'react';
import { useMemo, useState } from 'react';
import { useObservableLayoutSubscription } from './useObservableSubscription';
export function useObservableState(subject, initial) {
initial !== null && initial !== void 0 ? initial : (initial = subject.value);
const [state, setState] = useState(initial);
useObservableLayoutSubscription(subject, setState);
return state;
export function useObservableState(subject, opt) {
var _a;
const initial = (_a = opt === null || opt === void 0 ? void 0 : opt.initial) !== null && _a !== void 0 ? _a : subject.value;
const [next, setNext] = useState(initial);
const [error, setError] = useState(null);
const [complete, setComplete] = useState(false);
useObservableLayoutSubscription(subject, useMemo(() => ({ next: setNext, error: setError, complete: () => setComplete(true) }), []), opt === null || opt === void 0 ? void 0 : opt.teardown);
return { next, error, complete };
}
export default useObservableState;
//# sourceMappingURL=useObservableState.js.map
import { Observable } from '../types';
export declare function useObservableState<S>(subject: Observable<S>): S | undefined;
export declare function useObservableState<S>(subject: Observable<S>, initial: S): S;
type ObservableStateOptions<S> = {
initial?: S;
teardown?: VoidFunction;
};
type ObservableStateReturnType<S, E = unknown> = {
next: S;
error: E | null;
complete: boolean;
};
export declare function useObservableState<S>(subject: Observable<S>): ObservableStateReturnType<S>;
export declare function useObservableState<S, E = unknown>(subject: Observable<S>, opt?: ObservableStateOptions<S>): ObservableStateReturnType<S, E>;
export default useObservableState;
{
"name": "@equinor/fusion-observable",
"version": "4.0.1",
"version": "6.0.0",
"description": "WIP",

@@ -72,3 +72,3 @@ "keywords": [

},
"gitHead": "85cb1b4a12ef25787cd6d88da648c566c810b9f5"
"gitHead": "48e578f429ca02ed6bb0240d7c8ae64a80ed52a4"
}

@@ -101,3 +101,3 @@ # Observable

const { state$, setSelected } = useContext(TodoContext);
const items = useObservableState(state$);
const items = useObservableState(state$).next;
return (

@@ -104,0 +104,0 @@ <ul>

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc