Skip to content

Commit

Permalink
Remove cancellation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayc0 committed Jul 30, 2023
1 parent 90d81db commit 90ee4df
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/manatea/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,15 @@ export function orderCup<

const handlers = new Set<Handler<FlavoredTea>>();

let isPreviousCancelled = { value: false };
const setTea = (unflavoredTea: UnflavoredTea, context: Context) => {
const flavoredTeaRefill = flavoring(unflavoredTea, flavoredTea);
// Object.is is like `===` but consider that NaN === NaN, and +0 !== -0
if (Object.is(flavoredTea, flavoredTeaRefill)) {
return;
}
isPreviousCancelled.value = true;
const isCancelled = { value: false };
isPreviousCancelled = isCancelled;

flavoredTea = flavoredTeaRefill;
handlers.forEach(handler => {
if (isCancelled.value) {
return;
}
handler(flavoredTea, context);
});
};
Expand Down

0 comments on commit 90ee4df

Please sign in to comment.