updated README

This commit is contained in:
AJ ONeal 2015-01-15 21:48:54 -07:00
父節點 8dab8fcc4e
當前提交 b96dae1c34
共有 1 個文件被更改,包括 25 次插入18 次删除

查看文件

@ -70,25 +70,11 @@ It's an artifact of this project being born out of the ashes of my
### Getting Started
First off you need to have a browser and io.js/node.js compatible IIFE and declare a state object that will be used in every *desirae* action.
First off you need to declare a state object that will be used in every *desirae* action.
```javascript
/*jshint -W054 */
;(function (exports) {
'use strict';
var DesiraeMyModule = {}
, desi = {}
;
// ... a bunch of code ...
DesiraeMyModule.doStuff = doStuff;
exports.DesiraeMyModule = DesiraeMyModule.DesiraeMyModule = DesiraeMyModule;
}('undefined' !== typeof exports && exports || window));
;(function () {})
var desi = {}
;
```
After that you'll load any plugins you need.
@ -139,7 +125,28 @@ Desirae.write(desi, env).then(function () {
});
```
And be mindful that your code needs to run in both iojs/node and browser environments,
### Plugins
You need to start every file with a wrapper that is browser and io.js/node.js compatible
```javascript
/*jshint -W054 */
;(function (exports) {
'use strict';
var DesiraeMyModule = {}
;
// ... a bunch of code ...
DesiraeMyModule.doStuff = doStuff;
exports.DesiraeMyModule = DesiraeMyModule.DesiraeMyModule = DesiraeMyModule;
}('undefined' !== typeof exports && exports || window));
```
Other than that, just be mindful that your code needs to run in both iojs/node and browser environments
so steer away from things that are super iojs/node-ish or super window-ish.
Configuration