# abeluiux-nwjs-argv

> Arguments received by nwjs for vuejs

Latest version **0.0.7** (published 2017-11-25) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install abeluiux-nwjs-argv
pnpm add abeluiux-nwjs-argv
yarn add abeluiux-nwjs-argv
bun add abeluiux-nwjs-argv
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2017-11-25 |
| First published | 2017-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | abeluiux@gmail.com |
| Maintainers | abeluiux |
| Keywords | abeluiux, argv, mri, nw, nwjs, vue, vuejs |

## Links

- npm: https://www.npmjs.com/package/abeluiux-nwjs-argv
- Repository: https://github.com/abeluiux/abeluiux-nwjs-argv
- Homepage: https://github.com/abeluiux/abeluiux-nwjs-argv#readme
- Issues: https://github.com/abeluiux/abeluiux-nwjs-argv/issues
- npm.io page: https://npm.io/package/abeluiux-nwjs-argv

## Dependencies (1)

- [mri](https://npm.io/package/mri.md) ^1.1.0

## Recent versions

- 0.0.7 (latest) — 2017-11-25
- 0.0.6 — 2017-11-22
- 0.0.5 — 2017-11-04
- 0.0.4 — 2017-10-19
- 0.0.3 — 2017-10-16
- 0.0.2 — 2017-10-14

## README

Arguments received by [nwjs](https://nwjs.io/) for [vuejs 2.x](https://vuejs.org/)

## Install
```sh
$ npm i abeluiux-nwjs-argv
or
$ yarn add abeluiux-nwjs-argv
```

## Usage
- In the `main.js` of your project vuejs
```js
import 'abeluiux-nwjs-argv'
// 
import Vue from 'vue'

new Vue({
    el       : {...} ,
    template : {...} ,
})
```
- Send arguments to nwjs executable
```sh
$ nw -foo --bar=bar --baz="baz tar"
```
- Use in any component vuejs
```html
<template>{...}</template>

<script>

    export default {
        created() {
            console.log(nwjs.argv)
            // {foo: true, bar:'bar', baz='baz tar', ...}
        }
    }

</script>
```
- Send your arguments as many times as you need

```sh
$ nw --new
$ nw --other
```

```html
<template>{...}</template>

<script>

    export default {
        created() {
            /**
             * nwjs.on.open(function, boolean?)
             * 
             * function : vuejs method
             * boolean  : Return arguments as object or string
             *            Default true
             * 
            */
            nwjs.on.open(this.getArgv)
        },

        methods : {
            getArgv(argv) {
                console.log(argv)
                // {new: true, ...}
                // {other: true, ...}
            }
        }
    }

</script>
```
- Send your arguments as object or array

```sh
$ nw --person="{'name': 'louis', 'age': '25'}"
$ nw --fruits="['apple', 'orange', {others: ['strawberry']}]"
```
```html
<template>{...}</template>

<script>

    export default {
        created() {
            nwjs.on.open(this.getArgv)
        },

        methods : {
            getArgv(argv) {
                console.log(argv)
                /**
                    person: {
                        name: 'louis',
                        age: 25
                    }

                    fruits: [
                        'apple',
                        'orange',
                        { others: ['strawberry'] },
                        ...
                    ]
                */
            }
        }
    }

</script>
```

---
_Source: https://npm.io/package/abeluiux-nwjs-argv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
