Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. function umd(name, api) {
  2. if (typeof exports === "object" && typeof module !== "undefined") {
  3. module.exports = api;
  4. } else if (typeof define === "function" && define.amd) {
  5. define([], function() { return api; });
  6. } else {
  7. var globalScope;
  8. if (typeof window !== "undefined") {
  9. globalScope = window;
  10. } else if (typeof global !== "undefined") {
  11. globalScope = global;
  12. } else if (typeof self !== "undefined") {
  13. globalScope = self;
  14. } else {
  15. globalScope = this;
  16. }
  17. globalScope[name] = api;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement