Skip to content

Commit dda8f4c

Browse files
committed
feat: now plugin is vue3 compatible
1 parent 28ec7aa commit dda8f4c

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ You can for example display it after a connection process or when reading an art
77

88
Install it with npm
99

10-
### Vue 3 install
11-
12-
```bash
13-
npm install @owliehq/vue-addtohomescreen@next
14-
```
15-
16-
Or Yarn
17-
18-
```bash
19-
yarn add @owliehq/vue-addtohomescreen@next
20-
```
21-
22-
### Vue 2 install
23-
2410
```bash
2511
npm install @owliehq/vue-addtohomescreen
2612
```
@@ -33,7 +19,7 @@ yarn add @owliehq/vue-addtohomescreen
3319

3420
## Usage
3521

36-
### Vue3 init
22+
### Vue 3 init
3723

3824
First, you'll need to initialize the plugin and ask Vue to use it:
3925

@@ -46,7 +32,7 @@ const app = createApp(App);
4632
app.use(VueAddtohomescreen);
4733
```
4834

49-
### Vue2 init
35+
### Vue 2 init
5036

5137
First, you'll need to initialize the plugin and ask Vue to use it:
5238

index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import Vue from "vue";
21
import addToHomescreen from "./addToHomescreen";
32
import { isStandalone } from "./utils";
43
import Cookies from "js-cookie";
4+
import Vue from "vue";
55

66
export default {
77
install(vue, opts) {
@@ -11,7 +11,7 @@ export default {
1111
vue.prototype.$deferedAddToHomescreen = e;
1212
});
1313
}
14-
Vue.component(addToHomescreen.name, addToHomescreen);
14+
vue.component(addToHomescreen.name, addToHomescreen);
1515

1616
const addToHomescreenProt = {
1717
mount: (opt) => {
@@ -22,7 +22,10 @@ export default {
2222
root.$mount(document.body.appendChild(document.createElement("div")));
2323
},
2424
};
25-
//
26-
vue.prototype.$addToHomescreen = addToHomescreenProt;
25+
if (vue.provide) {
26+
vue.provide("addToHomescreen", addToHomescreenProt);
27+
} else {
28+
vue.prototype.$addToHomescreen = addToHomescreenProt;
29+
}
2730
},
2831
};

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@owliehq/vue-addtohomescreen",
3-
"version": "1.3.6",
4-
"description": "Add to homescreen prompt solution for all devices (desktop PC/OSX, IOS, Android).",
3+
"version": "1.4.0",
4+
"description": "Add to homescreen prompt solution for all devices (desktop PC/OSX, IOS, Android). Now Vue3 Compatible.",
55
"main": "index.js",
66
"scripts": {
77
"lint": "eslint --ext .js,.vue --ignore-path .gitignore ./",

0 commit comments

Comments
 (0)