Skip to content

Commit

Permalink
adds close to standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-t-wang committed Aug 8, 2024
1 parent 5f0f8f5 commit 3b10c3f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/standalone/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ const open = () => {
})
}

const close = () => {
return new Promise((_, reject) => {
if (!isInitialized) return reject(__('IDKitWidget is not initialized'))
useIDKitStore.setState({ open: false })
})
}

/**
* Reset internal state. Useful for unit-testing
*/
Expand All @@ -69,6 +76,7 @@ const IDKit = {
init,
update,
open,
close,
reset,
get isInitialized() {
return isInitialized
Expand Down

0 comments on commit 3b10c3f

Please sign in to comment.