Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hasInjectionContext is not defined by [#233](https://github.com/v… #234

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ exports.Vue2 = undefined
exports.isVue2 = false
exports.isVue3 = true
exports.install = function(){}

exports.hasInjectionContext = () => !!Vue.getCurrentInstance()
2 changes: 2 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export {
isVue3,
install,
}

export function hasInjectionContext(): boolean
6 changes: 6 additions & 0 deletions lib/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Vue from 'vue'
import {getCurrentInstance} from "vue";

var isVue2 = false
var isVue3 = true
Expand Down Expand Up @@ -32,3 +33,8 @@ export {
isVue3,
install,
}

//Fix hasInjectionContext is not defined https://github.com/vueuse/vue-demi/issues/233
export function hasInjectionContext() {
return !!getCurrentInstance()
}
2 changes: 2 additions & 0 deletions lib/v3/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ exports.Vue2 = undefined
exports.isVue2 = false
exports.isVue3 = true
exports.install = function(){}

exports.hasInjectionContext = () => !!Vue.getCurrentInstance()
2 changes: 2 additions & 0 deletions lib/v3/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export {
isVue3,
install,
}

export function hasInjectionContext(): boolean
6 changes: 6 additions & 0 deletions lib/v3/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Vue from 'vue'
import {getCurrentInstance} from "vue";

var isVue2 = false
var isVue3 = true
Expand Down Expand Up @@ -32,3 +33,8 @@ export {
isVue3,
install,
}

//Fix hasInjectionContext is not defined https://github.com/vueuse/vue-demi/issues/233
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v3 already has the function so this should be removed

Copy link
Author

@qq958691165 qq958691165 May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

But I can not found that function in v3.3.4, and so much programer to feedback this question

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export function hasInjectionContext() {
return !!getCurrentInstance()
}