Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AMD modules (Require.js) #9

Open
mvasilkov opened this issue Feb 7, 2017 · 0 comments
Open

Add support for AMD modules (Require.js) #9

mvasilkov opened this issue Feb 7, 2017 · 0 comments

Comments

@mvasilkov
Copy link

Because compatibility.

Something along these lines would do:

(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define([], factory);
    } else if (typeof module === 'object' && module.exports) {
        // Node.
        module.exports = factory();
    } else {
        // Browser globals (root is window)
        root.noop = factory();
  }
}(this, function () {
    // Return a value to define the module export.
    return function noop(){};
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants