Skip to content

Commit

Permalink
feat(plugin): add nuxt context to accepted / declined calls
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed Oct 12, 2022
1 parent c5c54e6 commit 9ac2fd0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/runtime/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default defineNuxtPlugin((nuxtApp) => {
})
if (disabled.length > 0) {
disabled.forEach((c) => {
if (c.declined) c.declined()
if (c.declined) c.declined().call(nuxtApp)
if (c.ids && c.ids.length > 0) {
c.ids.forEach((i) => {
methods.remove(i)
Expand All @@ -223,7 +223,7 @@ export default defineNuxtPlugin((nuxtApp) => {
script.src = c.src
head.appendChild(script)
script.addEventListener('load', () => {
if (c.accepted) c.accepted()
if (c.accepted) c.accepted().call(nuxtApp)
})
}
})
Expand All @@ -233,7 +233,7 @@ export default defineNuxtPlugin((nuxtApp) => {
const callAcceptedFunctions = () => {
if (state.enabled.length > 0) {
state.enabled.forEach((c) => {
if (c.accepted) c.accepted()
if (c.accepted) c.accepted().call(nuxtApp)
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export interface Cookie {
identifier?: string
name: string | Record<string, string>
src?: string
accepted?: () => void
declined?: () => void
accepted?: Function
declined?: Function
}

export interface I18n {
Expand Down

0 comments on commit 9ac2fd0

Please sign in to comment.