Giter Site home page Giter Site logo

Comments (3)

zowens avatar zowens commented on August 16, 2024

@jrburke What's the motivation behind not calling the error callback when a module fails to load? I currently have some fallback behavior in an error callback that won't work with almond and would be willing to do a pull request with the error callback being applied.

from almond.

jrburke avatar jrburke commented on August 16, 2024

The idea behind almond was that it was just a simpler AMD API provider for some modules that are already all built into a file. It cannot do dynamic loading, so the uses for an error handler did not seem worth increasing the size of almond as it would put a tax on all users of almond.

Feel free to create a fork of almond though and add the behavior. Then you can add it to this list so that others who may want it can find it:
https://github.com/jrburke/requirejs/wiki/AMD-API-Shims

from almond.

zowens avatar zowens commented on August 16, 2024

@jrburke I can imitate it easily with

setTimeout(function() {
     try {
         require(['modules-that-doesnt-exist'], function(dep){...}, undefined, true);
     } catch(e) {
         // .... failure behavior....
     }
}, 4);

But it seems like I could easily just change a couple lines in the main function around line 296 to check for, and invoke, an error callback... only a couple extra lines would be necessary. Plus it would keep parody with require.js without actually doing a dynamic script load.

Since I found a work-around, it's not critical, just thought I'd suggest it.

from almond.

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.