Skip to content

Commit

Permalink
readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
SimulatedGREG committed Jun 2, 2016
1 parent a02b0b9 commit f8bd0c0
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
# Vue-electron
> The vue plugin that wraps common [electron](https://github.com/electron/electron) APIs.
> The vue plugin that wraps [electron](https://github.com/electron/electron) APIs to the Vue object.
**This plugin is in early ___development___.**
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)


## Installing
Install using NPM
```
npm install vue-electron --save
```

Include using webpack or browserify

**main.js**
```js
import Vue from 'vue'
import VueElectron from 'vue-electron'

Vue.use(VueElectron)
```

## Using the plugin
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`.

So instead of...
```js
const electron = require('electron')

export default {
methods: {
getName () {
return electron.remote.app.getName()
}
}
}
```

Now you can...

```js
export default {
methods: {
getName () {
return this.$electron.remote.app.getName()
}
}
}
```

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.
4 changes: 2 additions & 2 deletions src/vue-electron.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
install (Vue) {
module.exports = {
install: function (Vue) {
Vue.prototype.$electron = require('electron')
}
}

0 comments on commit f8bd0c0

Please sign in to comment.