Skip to content

Commit f8bd0c0

Browse files
committed
readme update
1 parent a02b0b9 commit f8bd0c0

File tree

2 files changed

+51
-4
lines changed

2 files changed

+51
-4
lines changed

README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,51 @@
11
# Vue-electron
2-
> The vue plugin that wraps common [electron](https://github.com/electron/electron) APIs.
2+
> The vue plugin that wraps [electron](https://github.com/electron/electron) APIs to the Vue object.
33
4-
**This plugin is in early ___development___.**
4+
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
5+
6+
7+
## Installing
8+
Install using NPM
9+
```
10+
npm install vue-electron --save
11+
```
12+
13+
Include using webpack or browserify
14+
15+
**main.js**
16+
```js
17+
import Vue from 'vue'
18+
import VueElectron from 'vue-electron'
19+
20+
Vue.use(VueElectron)
21+
```
22+
23+
## Using the plugin
24+
This plugin will attach electron APIs to the Vue object itself, so accessing all APIs is dead simple. All official documentation from electron can be used and accessed from `this.$electron`.
25+
26+
So instead of...
27+
```js
28+
const electron = require('electron')
29+
30+
export default {
31+
methods: {
32+
getName () {
33+
return electron.remote.app.getName()
34+
}
35+
}
36+
}
37+
```
38+
39+
Now you can...
40+
41+
```js
42+
export default {
43+
methods: {
44+
getName () {
45+
return this.$electron.remote.app.getName()
46+
}
47+
}
48+
}
49+
```
50+
51+
Now you might be thinking, "Is it really that annoying to simply require electron to access it?" Probably not, but it can get cumbersome to have to include it in every component file that needs it. In the end, attaching electron directly to Vue just makes sense.

src/vue-electron.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export default {
2-
install (Vue) {
1+
module.exports = {
2+
install: function (Vue) {
33
Vue.prototype.$electron = require('electron')
44
}
55
}

0 commit comments

Comments
 (0)