Skip to content

Commit

Permalink
fix: replace arrow functions for compatibility (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
cccblade committed Feb 1, 2024
1 parent 01e799b commit 253ae19
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/index.iife.js
Expand Up @@ -19,7 +19,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
VueDemi.Vue2 = Vue
VueDemi.version = Vue.version
VueDemi.warn = Vue.util.warn
VueDemi.hasInjectionContext = () => !!VueDemi.getCurrentInstance()
VueDemi.hasInjectionContext = function() {
return !!VueDemi.getCurrentInstance()
}
function createApp(rootComponent, rootProps) {
var vm
var provide = {}
Expand Down Expand Up @@ -72,7 +74,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
VueDemi.Vue = Vue
VueDemi.Vue2 = Vue
VueDemi.version = Vue.version
VueDemi.hasInjectionContext = () => !!VueDemi.getCurrentInstance()
VueDemi.hasInjectionContext = function() {
return !!VueDemi.getCurrentInstance()
}
} else {
console.error('[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.')
}
Expand Down
4 changes: 3 additions & 1 deletion lib/v2.7/index.cjs
Expand Up @@ -55,4 +55,6 @@ Object.keys(VueModule).forEach(function (key) {
})

// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
exports.hasInjectionContext = () => !!VueModule.getCurrentInstance()
exports.hasInjectionContext = function() {
return !!VueModule.getCurrentInstance()
}
4 changes: 3 additions & 1 deletion lib/v2/index.cjs
Expand Up @@ -29,4 +29,6 @@ exports.install = install
exports.version = Vue.version

// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
exports.hasInjectionContext = () => !!VueCompositionAPI.getCurrentInstance()
exports.hasInjectionContext = function () {
return !!VueCompositionAPI.getCurrentInstance()
}

0 comments on commit 253ae19

Please sign in to comment.