Skip to content

Commit

Permalink
refactor(extensions/updateListener): use default extension when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
exuanbo committed Dec 7, 2023
1 parent 5f43eb9 commit 609ae88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .yarn/versions/95bd9d0a.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@codemirror-toolkit/extensions": patch
3 changes: 3 additions & 0 deletions packages/extensions/src/updateListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const updateListenerField = /*#__PURE__*/ StateField.define<UpdateListenerSet>({
})

export function updateListener(...initialListeners: UpdateListener[]): Extension {
if (!initialListeners.length) {
return updateListenerField.extension
}
return updateListenerField.init(() => new Set(initialListeners))
}

Expand Down

0 comments on commit 609ae88

Please sign in to comment.