# nw-dev-toolkit

> NW Dev Toolkit is a toolbox for nw.js (node-webkit) development

Latest version **0.4.1** (published 2017-02-24) · GPL-3.0 license · 0 weekly downloads

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

## Install

```sh
npm install nw-dev-toolkit
pnpm add nw-dev-toolkit
yarn add nw-dev-toolkit
bun add nw-dev-toolkit
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2017-02-24 |
| First published | 2017-02-21 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Woem |
| Maintainers | woem |
| Keywords | nw, node-webkit, nwjs, nw.js, dev, tools, toolkit |

## Links

- npm: https://www.npmjs.com/package/nw-dev-toolkit
- Repository: https://github.com/MeowWoem/nw-dev-toolkit
- Homepage: https://github.com/MeowWoem/nw-dev-toolkit#readme
- Issues: https://github.com/MeowWoem/nw-dev-toolkit/issues
- npm.io page: https://npm.io/package/nw-dev-toolkit

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.4.1 (latest) — 2017-02-24
- 0.4.0 — 2017-02-24
- 0.3.0 — 2017-02-22
- 0.2.5 — 2017-02-22
- 0.2.0 — 2017-02-21
- 0.1.11 — 2017-02-21
- 0.1.1 — 2017-02-21
- 0.1.0 — 2017-02-21
- 0.0.1 — 2017-02-21

## README

# NW Dev Toolkit
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]

##### THIS README IS NOT COMPLETE! PLEASE BE PATIENT.

## Description
**NW Dev Toolkit** is a toolkit for [nw.js (node-webkit)](https://nwjs.io/) development

## Features
* Fully customizable!
* A recursive function to extends objects. That too create a camelCase named copy of kebab-case named properties. It's useful maintaining the readability of configurations objects.
* Predefined shortcuts that enhance the developer experience<br>
  * Refresh window (`Left Control`+`R` _or_ `F5` by default)
  * Refresh window and clear the require cache (`Left Control`+`Left Shift`+`R` _or_ `F6` by default)
* A way to attach easily a shortcut to window (using [DOM Level 3 KeyboardEvent code Values](https://www.w3.org/TR/2014/WD-DOM-Level-3-Events-code-20140612/))

## Installation

### Using NPM : 
In the root folder of your [nw.js](https://nwjs.io/) app.
```sh
$ npm install nw-dev-toolkit
```
In the `node_modules` folder of your [nw.js](https://nwjs.io/) app.

### Using Git : 
```sh
$ git clone https://github.com/MeowWoem/nw-dev-toolkit.git
```

## Quick start

### Requirement :

Before starts you need to create an [nw.js](https://nwjs.io/) app if it is not already done ([follow this guide if you need](https://github.com/nwjs/nw.js/wiki/Getting-Started-with-nw.js)).

Then in your `index.html` adds these following lines in `<head>` tag **before any other executable scripts** : 
```html
<script>
	require("nw-dev-toolkit").init(window);
</script>
```

### Extends your objects :
You can extends your objects recursively.
```javascript
var tool = require("nw-dev-toolkit"); // The tool must already be initialized

var defaultOptions = {
	foobar: {
		foo: "Hello",
	},
	"i-wanna-to-be-transformed-to-camel-case": true
};


var newOptions = {
	foobar: {
		bar: "World"
	}
};

newOptions = tool.extend({}, defaultOptions, newOptions);

console.log(newOptions);

/*
That logs :
{
	"foobar": {
		"foo": "Hello",
		"bar": "World"
	},
	"i-wanna-to-be-transformed-to-camel-case": true,
	"iWannaToBeTransformedToCamelCase": true
}
*/

```

### Load Node Module directly in DOM
Some modules, such as jQuery or bootstrap, need to include files in the DOM (JS or CSS). It is sometimes annoying to add them manually to the code, the paths to the modules are usually long.
Now with our module you can replace the node "require" function by the DOMInjector API for this type of modules. The loaded modules will be automatically added to the DOM.
#### Examples :
```javascript
var tool = require("nw-dev-toolkit"); // The tool must already be initialized

var loader = new tool.modules.DOMInjector();

loader.add("jquery", "tether");
loader.add("bootstrap");

loader.load().then(function() {
	console.log("loading complete");
});

```

### Works with shortcut :
You can easily add shortcuts using standards [DOM Level 3 KeyboardEvent code Values](https://www.w3.org/TR/2014/WD-DOM-Level-3-Events-code-20140612/).
You can assign multiple shortcuts for the same function at once by separates key codes with comma.

#### Examples :
* **To add a shortcut :**
```javascript
var tool = require("nw-dev-toolkit"); // The tool must already be initialized

var myShortcut01 = function(e) {
	console.log("Shortcut 01 fired!", e);
}

tool.shortcuts.add("ControlLeft+V,ShiftLeft+V", myShortcut01);

var myShortcut02 = function(e) {
	console.log("Shortcut 02 fired!", e);
}

tool.shortcuts.add("ControlLeft+V,ShiftLeft+V", myShortcut02);
```

* **To remove them :**
```javascript

// Remove all shortcut with these key codes and this callback
tool.shortcuts.remove("ControlLeft+V,ShiftLeft+V", myShortcut01); 

// Remove all shortcut  with these key codes
tool.shortcuts.remove("ControlLeft+V,ShiftLeft+V"); 

// Remove all shortcut with this key code and this callback
tool.shortcuts.remove("ShiftLeft+V", myShortcut01); 

// Remove all shortcut with this key code
tool.shortcuts.remove("ShiftLeft+V"); 

```

[npm-image]: https://img.shields.io/npm/v/nw-dev-toolkit.svg
[npm-url]: https://npmjs.org/package/nw-dev-toolkit
[downloads-image]: https://img.shields.io/npm/dm/nw-dev-toolkit.svg
[downloads-url]: https://npmjs.org/package/nw-dev-toolkit

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