UNPKG

@pexip/signal

Version:

an observer pattern while avoiding boilerplate code. https://en.wikipedia.org/wiki/Signals_and_slots

313 lines (172 loc) 4.99 kB
# Changelog ## 16.9.3 ### Patch Changes - 13e3722: Generate the package documentation in a folder called doc-dist ## 16.9.2 ### Patch Changes - aac2518: Add more trace log ## 16.9.1 ### Patch Changes - a551f01: Add clearBuffers method to clear the buffers. ## 16.9.0 ### Minor Changes - 6fddc11: Support `AbortSignal`. ## 16.8.0 ### Minor Changes - db3a370: Add batched signal variant A new Signal variant, `batched`, is added to have batched emits. Batched Signal variant will not emit the subject immediately. Depending on the provided `schedule` function which decides the timing of emitting the subject(s), the Signal keeps buffering the subjects into a buffer with the size limit by `bufferSize` (only the latest `bufferSize` items are kept). The `schedule` function can simply be a wrapper of `setTimeout` or from the [Scheduler API](https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask)'s `postTask` to form a time window for batching. - 3555d9d: Adds `build:sourcemap` script. - 3cb5aee: Add an option to allow emitting the signal when the buffer size is full to avoid data lost - ed53b05: Upgrade Typescript ### Patch Changes - fa06b8b: Fix batched and replay signal buffer size warning - 941363c: Lint with recommended rules - e76a15e: Migrate to biome linter ## 16.7.1 ### Patch Changes - d98fe9d: Move to module type. ## 16.7.0 ### Minor Changes - 4a1908a: Use tsc to build packages - ec134d1: Node.js and Storybook upgrade and migration ## 16.6.0 ### Minor Changes - bcfa59f: Add debug flag to show for info ## 16.5.0 ### Minor Changes - 6225612: Remove @pexip/logger dependency ## 16.4.0 ### Minor Changes - 6534b17: Remove logger dependency ## 16.3.0 ### Patch Changes - @pexip/logger@16.3.0 ## 16.2.0 ### Patch Changes - @pexip/logger@16.2.0 ## 16.1.0 ### Patch Changes - @pexip/logger@16.1.0 ## 16.0.0 ### Patch Changes - @pexip/logger@16.0.0 ## 15.0.0 ### Patch Changes - @pexip/logger@15.0.0 ## 14.1.0 ### Patch Changes - @pexip/logger@14.1.0 ## 14.0.0 ### Patch Changes - @pexip/logger@14.0.0 ## 13.2.0 ### Patch Changes - @pexip/logger@13.2.0 ## 13.1.0 ### Patch Changes - @pexip/logger@13.1.0 ## 13.0.0 ### Patch Changes - @pexip/logger@13.0.0 ## 12.0.0 ### Minor Changes - 52cd2cdb: observer function can be async ### Patch Changes - @pexip/logger@12.0.0 ## 11.0.0 ### Patch Changes - @pexip/logger@11.0.0 ## 10.1.0 ### Patch Changes - @pexip/logger@10.1.0 ## 10.0.0 ### Patch Changes - @pexip/logger@10.0.0 ## 9.0.0 ### Patch Changes - @pexip/logger@9.0.0 ## 8.0.0 ### Patch Changes - @pexip/logger@8.0.0 ## 7.0.0 ### Patch Changes - Updated dependencies [efc7d2a8] - @pexip/logger@7.0.0 ## 6.0.0 ### Patch Changes - @pexip/logger@6.0.0 ## 5.0.0 ### Patch Changes - @pexip/logger@5.0.0 ## 4.0.0 ### Patch Changes - @pexip/logger@4.0.0 ## 2.0.1 ### Patch Changes - Updated dependencies [46b70ba43] - @pexip/logger@2.1.0 ## 2.0.0 ### Minor Changes - 89ef2b1aa: Remove `useSignal`, `useSignalState` and `useSignalStateSync` and cleanup README ### Patch Changes - Updated dependencies [29741a2d4] - Updated dependencies [958250434] - Updated dependencies [04752bc9d] - Updated dependencies [29741a2d4] - @pexip/logger@2.0.0 ## 1.4.0 ### Minor Changes - 5c9120efd: Track changes using changesets ## [0.6.2] - 2021-03-23 ### Fixed - Move some devDeps to deps [#1397](https://gitlab.com/pexip/zoo/-/issues/1397) ## [0.6.1] - 2021-02-12 ### Added - `useSignalStateSync` export ## [0.6.0] - 2021-02-12 ### Added - add `useSignalStateSync` hook ## [0.5.4] - 2021-02-08 ### Fixed - use `logger.trace` instead of `logger.debug` ## [0.5.3] - 2020-12-02 ### Fixed - Export `Detach` type - Add a default name when there is no name for signal and observer - Reorder some log messages [#2629] ## [0.5.2] - 2020-10-30 ### Changed - Correct return type of `useSignalState` according to `React['useState']` [#2085] ## [0.5.1] - 2020-10-29 ### Changed - Export all custom types [#2074] ## [0.5.0] - 2020-10-21 ### Changed - **BREAKING**: Remove `useBuffer`, and replace with `variant` options, can either be `generic`, `behavior` or `replay`. [#1915](https://github.com/pexip/aquila-research/pull/1915) If you are using `useBuffer` from version 0.4, you can set `{variant: 'behavior'}` or `{variant: 'replay'}` depends on your needs - Use logger [#1764](https://github.com/pexip/aquila-research/pull/1764) ### Added - Add `useSignalState` hook [#1890](https://github.com/pexip/aquila-research/pull/1890) - Add `useSignal` hook [#1830](https://github.com/pexip/aquila-research/pull/1830) - Add optional `name` to name the signal when using `createSignal` and print debug messages for the life cycle [#1915](https://github.com/pexip/aquila-research/pull/1915) ### Fixed - Fix signal hooks issue which causing unnecessary update [#1915](https://github.com/pexip/aquila-research/pull/1915)