Skip to content

Commit

Permalink
feat: pass extensionContext to setup function
Browse files Browse the repository at this point in the history
  • Loading branch information
kermanx committed Oct 26, 2024
1 parent 73d772d commit 87935ee
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/core/src/utils/defineExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const extensionScope = effectScope()
*
* @category lifecycle
*/
export function defineExtension<T>(setup: () => T) {
export function defineExtension<T>(setup: (context: ExtensionContext) => T) {
return {
activate: (extCtx: ExtensionContext) => {
extensionContext.value = extCtx
activate: (context: ExtensionContext) => {
extensionContext.value = context
return extensionScope.run(() => {
activateCbs.map(fn => fn(extCtx))
return setup()
activateCbs.map(fn => fn(context))
return setup(context)
})
},
deactivate: () => {
Expand Down

0 comments on commit 87935ee

Please sign in to comment.