Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function umd(name, api) {
- if (typeof exports === "object" && typeof module !== "undefined") {
- module.exports = api;
- } else if (typeof define === "function" && define.amd) {
- define([], function() { return api; });
- } else {
- var globalScope;
- if (typeof window !== "undefined") {
- globalScope = window;
- } else if (typeof global !== "undefined") {
- globalScope = global;
- } else if (typeof self !== "undefined") {
- globalScope = self;
- } else {
- globalScope = this;
- }
- globalScope[name] = api;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement