genkgo / ember-localforage-adapter

Offline usage for Ember Data, based on localstorage adapter, but now uses Mozilla's localforage as data source
Other
133 stars 26 forks source link

Request: remove bower_component "localforage" as dependency #74

Closed driesdl closed 5 years ago

driesdl commented 6 years ago

When performing ember install ember-localforage-adapter

it also installs a bower_component called 'localforage', woudl it be possible to remove this as a dependency? Or there any alternatives?

frederikbosch commented 6 years ago

Driezzz, would you able to create a PR for this?

driesdl commented 6 years ago

@frederikbosch I'll try.

NullVoxPopuli commented 6 years ago

Here is a hack:

yarn add localforage
// ember-cli-build.js
  app.import('node_modules/localforage/dist/localforage.js');
  app.import('vendor/shims/localforage.js');
// vendor/shims/localforage.js
(function() {
  function vendorModule() {
    'use strict';

    return {
      'default': self['localforage'],
      __esModule: true,
    };
  }

  define('localforage', [], vendorModule);
})();
mkdir -p bower_components
cd bower_components
ln -s ../node_modules/localforage localforage

I copied the adapter and serializer into my app, and am just using those. I had to change window.localforage to just localforage and then import localforage from 'localforage' I also added messages to all the promise rejections, because undefined errors are obnoxious :-)

frederikbosch commented 5 years ago

See master branch.