Giter Site home page Giter Site logo

modulejs's People

Contributors

lrsjng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modulejs's Issues

Add changelog.md

Hi,

Could you, provide the changelog of the last versions. I'm asking it because, just looking at commits sometimes is hard to get know about the news, bugfixes and maybe break changes.

Thank you and great work! (:

It's not working in browser

Babel remapping ES6 "this" to undefined.

// ...
(function (root, factory) {
    // istanbul ignore else
    if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
        module.exports = factory();
    } else {
        root.modulejs = factory(); // throw: Uncaught TypeError: Cannot set property 'modulejs' of undefined
    }
})(undefined, function () { // <-------------------------
    // eslint-disable-line no-invalid-this
    var OBJ_PROTO = Object.prototype;
// ...

Declare browser support

In order to be used in production, this library should declare it's browser support.
I see that dist uses Array.isArray which means no browser older than:

  • IE9,
  • Chrome 5,
  • Firefox 4,
  • Safari 5,
  • Opera 10.5

is supported.

Possibility to "re-define" the module?

Hi Lars!

Thanks for modulejs! I am a happy user.
Recently though, I have come accross a problem in my test environment. I have a module, which is a "shared state" between other modules.
(Ugly, I know... It is my implementation of something like "event bus" and so far I did not come with a good idea how to publish events on bus and listen to them without sharing the bus object)

Well, it turns out I would like to inject a mock of the bus so that I have more control over what is happening, most specifically I want to make a bus, which is normally asynchronous, synchronous.

I know I can provide a different implementation of the dependency in third argument of .require method, but that does only override it in the module under the test. If that module happens to use another module, which in turns uses the module I want to override, it won't be overriden and I end up with two different instances of what should be one.

Maybe it is better to describe it using a little diagram:

A  --> B  (module A depends on B)
A --> C

B --> C

If I now use

modulejs.require('A', {
 'C' : D
});

I will end up with:

A(B,D)
B(C)

while I want

A(B,D)
B(D)

I could of course require also module B this way:

modulejs.require ('B', {
  'C' : D
});

But that makes it overly complicated as I am exposing dependencies of dependencies of the module under the test. That seems to be very fragile.

So, I was wondering whether you though of any way, how to (temporarily) be able to override a module definition that would spread across ALL modules?
Or, is there a better way to overcome that?

modulejs.run

It would be nice if moduleJS would offer a "modulejs.run" method which will run a code when all required libraries are available, ie:

modulejs.run(['jquery', 'graphics/fx'], function() {
  // run this after loading of jquery and graphics/fx
})

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.