mozilla/localForage — pull request #203 by hawkrives (2014-07-09 16:22:04+00:00)
Title: Add Browserify support

Should fix #174.

There are three main changes here:

1. Point the `main` and `browser` keys in package.json at the source files, rather than the compiled files.
- Browserify was looking for separate drivers in the /dist/drivers folder, which don't exist.
2. Require `es6-promise` instead of `promise` in the `var Promise` ternary statements.
- Because `es6-promise` returns an object like `{Promise: function(), polyfill: function()}`, I chose to return the Promise object.
- It works in Safari 7, which doesn't have native Promises, and passes the tests, so I think it's good.
3. Along with that, I required `es6-promise` in the `dependencies` section of `package.json`.

## Tests

I tried running tests, but these two failed, and I'm not sure why/what it means. Given the comments on #199, it looks like it's a bigger issue than just my changes, so I'm not worried.

```bash
Running "mocha:unit" (mocha) task
Testing: http://localhost:9999/test/test.component.html

․․

0 passing (1ms)
2 failing

1) localForage API "before each" hook:
TypeError: 'undefined' is not a function (evaluating 'localforage.clear(done)')
at http://localhost:9999/test/test.api.js:14
at http://localhost:9999/bower_components/mocha/mocha.js:4315
at next (http://localhost:9999/bower_components/mocha/mocha.js:4626)
at http://localhost:9999/bower_components/mocha/mocha.js:4630
at timeslice (http://localhost:9999/bower_components/mocha/mocha.js:5761)

2) Config API "before all" hook:
TypeError: 'undefined' is not a function (evaluating 'localforage.config()')
at http://localhost:9999/test/test.config.js:6
at callFn (http://localhost:9999/bower_components/mocha/mocha.js:4338)
at http://localhost:9999/bower_components/mocha/mocha.js:4331
at next (http://localhost:9999/bower_components/mocha/mocha.js:4626)
at http://localhost:9999/bower_components/mocha/mocha.js:4630
at timeslice (http://localhost:9999/bower_components/mocha/mocha.js:5761)
```