From 8dab8fcc4e44d32b836396b2a9cebee9dd8677c0 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 21:45:10 -0700 Subject: [PATCH] updated README --- README.md | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 22eda41..002ab3f 100644 --- a/README.md +++ b/README.md @@ -70,14 +70,34 @@ It's an artifact of this project being born out of the ashes of my ### Getting Started -First off you need to declare a state object that will be used in every *desirae* action. +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. ```javascript -var desi = {} - ; +/*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 () {}) ``` -After that you'll initialize Desirae with an *environment*. +After that you'll load any plugins you need. + +```javascript +Desi.registerDataMapper('ruhoh', window.DesiraeDatamapRuhoh || require('desirae-datamap-ruhoh').DesiraeDatamapRuhoh); +``` + +And then you'll initialize Desirae with an *environment*. ```javascript Desirae.init( @@ -119,6 +139,9 @@ Desirae.write(desi, env).then(function () { }); ``` +And 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 =============