Skip to content

Commit

Permalink
fix: merge with rename-produceNotifier
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jul 26, 2020
1 parent 0420e18 commit 05eaa73
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions packages/notifier/src/notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const supportLegacy = true;
// presence vs the absence of it, which we cannot do with the optional argument
// syntax. Rather we use the arity of the arguments array.
//
// If no initial state is provided to `produceNotifier`, then it starts without
// If no initial state is provided to `makeNotifierKit`, then it starts without
// an initial state. Its initial state will instead be the state of the first
// update.
export const makeNotifierKit = (...args) => {
Expand All @@ -96,11 +96,6 @@ export const makeNotifierKit = (...args) => {
done: final(),
}
: {};
if (supportLegacy && args.length === 0) {
// To accommodate old clients, for now we treat no initial state
// argument as if the argument defaults to undefined, as it used to.
args = [undefined];
}

if (args.length >= 1) {
// start as hasState() && !final()
Expand Down Expand Up @@ -181,6 +176,8 @@ export const makeNotifierKit = (...args) => {
return harden({ notifier, updater });
};

// Deprecated. TODO remove

export { makeNotifierKit as produceNotifier };
// Deprecated. TODO remove once no clients need it.
// Unlike makeNotifierKit, produceIssuerKit always produces
// a notifier with an initial state, which defaults to undefined.
export const produceNotifier = (initialState = undefined) =>
makeNotifierKit(initialState);

0 comments on commit 05eaa73

Please sign in to comment.