mirror of
https://github.com/dergigi/boris.git
synced 2025-12-27 11:34:50 +01:00
- Add project structure with TypeScript, React, and Vite - Implement nostr authentication using browser extension (NIP-07) - Add NIP-51 compliant bookmark fetching and display - Create minimal UI with login and bookmark components - Integrate applesauce-core and applesauce-react libraries - Add responsive styling with dark/light mode support - Include comprehensive README with setup instructions This is a minimal MVP for a nostr bookmark client that allows users to view their bookmarks according to NIP-51 specification.
56 lines
1.8 KiB
TypeScript
56 lines
1.8 KiB
TypeScript
import { MutableRefObject } from "react";
|
|
import { Observable, PartialObserver, Subscription } from "rxjs";
|
|
import { useIsomorphicLayoutEffect } from "./helpers";
|
|
import { useSubscriptionInternal } from "./internal/use-subscription-internal";
|
|
|
|
/**
|
|
* Same as [[useSubscription]] except the subscription is established
|
|
* under `useLayoutEffect`.
|
|
*
|
|
* Useful when values are needed before DOM paint.
|
|
*
|
|
* Use it scarcely as it runs synchronously before browser paint.
|
|
* Too many synchronous emissions from the observable could
|
|
* stretch the commit phase.
|
|
*
|
|
* @template TInput Input value within Observable.
|
|
*
|
|
* @param input$ Input Observable.
|
|
* @param observer Observer
|
|
*/
|
|
export function useLayoutSubscription<TInput>(
|
|
input$: Observable<TInput>,
|
|
observer?: PartialObserver<TInput>
|
|
): MutableRefObject<Subscription | undefined>;
|
|
/**
|
|
* @template TInput Input value within Observable.
|
|
*
|
|
* @param input$ Input Observable.
|
|
* @param next Notify when a new value is emitted.
|
|
* @param error Notify when a new error is thrown.
|
|
* @param complete Notify when the Observable is complete.
|
|
*/
|
|
export function useLayoutSubscription<TInput>(
|
|
input$: Observable<TInput>,
|
|
next?: ((value: TInput) => void) | null | undefined,
|
|
error?: ((error: any) => void) | null | undefined,
|
|
complete?: (() => void) | null | undefined
|
|
): MutableRefObject<Subscription | undefined>;
|
|
export function useLayoutSubscription<TInput>(
|
|
input$: Observable<TInput>,
|
|
observerOrNext$?:
|
|
| PartialObserver<TInput>
|
|
| ((value: TInput) => void)
|
|
| null
|
|
| undefined,
|
|
error?: ((error: any) => void) | null | undefined,
|
|
complete?: (() => void) | null | undefined
|
|
): MutableRefObject<Subscription | undefined> {
|
|
return useSubscriptionInternal(useIsomorphicLayoutEffect, [
|
|
input$,
|
|
observerOrNext$,
|
|
error,
|
|
complete,
|
|
]);
|
|
}
|