Coder Social home page Coder Social logo

Comments (6)

ocombe avatar ocombe commented on August 10, 2024

Could you do me a plunkr (or something similar) with the problem ? I'm not really good with requirejs and that would help me.
But as you explain it, it seems to be a bug with localforage more than with angular-localforage ?

from angular-localforage.

Gotusso avatar Gotusso commented on August 10, 2024

Sure. http://plnkr.co/edit/91UCt2E4OeFP6USpBeAH
(First time using plnkr, so tell me if it's not OK)

If you check the console you will find something like this:

Error: [$injector:modulerr] Failed to instantiate module LocalForageModule due to:
TypeError: Cannot read property 'config' of undefined
    at new <anonymous> (http://run.plnkr.co/RzZL8eJP9kWNJN0p/angular-localForage.js:13:14)
    at invoke (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js:3918:17)
    at Object.instantiate (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js:3929:23)
    at provider (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js:3785:36)
    at Object.provider (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js:3777:16)
    at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js:3837:37
    at Array.forEach (native)
    at forEach (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js:325:11)
    at loadModules (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js:3824:5)
    at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js:3831:40

This is because window.localforage is undefined, due the AMD style loading.

About if it's a bug with localforage, I think yes and no. In my opinion Localforage should provide something like .noConflict() method on jQuery to keep running with plugins without AMD support, but plugins should support AMD / CommonJS as well to be consistent.

from angular-localforage.

ocombe avatar ocombe commented on August 10, 2024

Sorry about letting this without an answer.
It seems that in 1.0 of localforage they changed the support for requireJS:

In pre-1.0 versions you had to call .ready() to make sure the code was loaded, but this is no longer necessary.

It may be working now, I'll test once I've updated the code to support 1.0.

from angular-localforage.

ocombe avatar ocombe commented on August 10, 2024

The version 1.0 has been released, do you still have the problem ?

from angular-localforage.

Gotusso avatar Gotusso commented on August 10, 2024

You're taking about localForage/localForage#182 right? Seems that require.js support on localforage was broken anyway.
However, the problem is still there as long as the code references window.localforage. We need to use AMD or Node style loading if the user is using it to keep this working.
I made a fix for this and I think it solves it all, but I have almost no idea about node so I can't try that part. AMD and regular loading work OK.
On the other hand I'm having some issues when running the tests because I'm getting some "Not authorized" errors on sauce connect. Do I need some credentials for it or something?

from angular-localforage.

ocombe avatar ocombe commented on August 10, 2024

Thanks for the PR! I'll test it and let you know.

Sauce labs credentials are not well configured on this repo, I need to change those, it's not your fault :-)

from angular-localforage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.