make readable start callback optional

pull/6293/head
Ignatius Bagus 5 years ago
parent 714b97a0a2
commit 77ea546017
No known key found for this signature in database
GPG Key ID: 357C6674A45CC06B

@ -248,7 +248,7 @@ This makes it possible to wrap almost any other reactive state handling library
store = writable(value?: any) store = writable(value?: any)
``` ```
```js ```js
store = writable(value?: any, callback?: (set: (value: any) => void) => () => void) store = writable(value?: any, start?: (set: (value: any) => void) => () => void)
``` ```
--- ---
@ -297,7 +297,7 @@ unsubscribe(); // logs 'no more subscribers'
#### `readable` #### `readable`
```js ```js
store = readable(value: any, callback: (set: (value: any) => void) => () => void) store = readable(value?: any, start?: (set: (value: any) => void) => () => void)
``` ```
--- ---

@ -50,8 +50,6 @@ const subscriber_queue = [];
* @param value initial value * @param value initial value
* @param {StartStopNotifier}start start and stop notifications for subscriptions * @param {StartStopNotifier}start start and stop notifications for subscriptions
*/ */
export function readable(): Readable<undefined>;
export function readable<T>(value: T, start: StartStopNotifier<T>): Readable<T>;
export function readable<T>(value?: T, start?: StartStopNotifier<T>): Readable<T> { export function readable<T>(value?: T, start?: StartStopNotifier<T>): Readable<T> {
return { return {
subscribe: writable(value, start).subscribe subscribe: writable(value, start).subscribe

Loading…
Cancel
Save