maybe.js 735 B

123456789101112131415161718192021222324252627282930
  1. define({
  2. load: function (name, require, onload) {
  3. if (require.on) {
  4. // Dojo
  5. // code from https://bugs.dojotoolkit.org/attachment/ticket/16416/t16416.html courtesy of rcgill
  6. require.on("error", function () {
  7. if (!require.modules[name].executed) {
  8. // yep, it had a problem; therefore...
  9. // put it back into the "unloaded" state
  10. require.undef(name);
  11. // define it another way..
  12. define(name, [], function () {
  13. return 0;
  14. });
  15. // this gets the loader to notice that the module showed up without being requested
  16. require([name]);
  17. }
  18. });
  19. }
  20. // RequireJS and Dojo
  21. require([name], function (value) {
  22. onload(value);
  23. }, function () {
  24. onload(undefined);
  25. });
  26. }
  27. });