Fix UMD pattern

This commit is contained in:
Gina Häußge 2017-01-19 17:24:21 +01:00
parent 7ab3eabe0f
commit b0cd742bf4
20 changed files with 89 additions and 54 deletions

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var exports = {};
exports.get = function(refresh, opts) {
@ -63,6 +63,8 @@
};
OctoPrint.plugins.pluginmanager = exports;
return OctoPrint.plugins.pluginmanager;
});
$(function() {

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var exports = {};
var url = OctoPrint.getBlueprintUrl("softwareupdate");
@ -78,6 +78,8 @@
};
OctoPrint.plugins.softwareupdate = exports;
return OctoPrint.plugins.softwareupdate;
});
$(function() {

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define("OctoPrint", ["jquery", "lodash"], factory);
} else {
global.OctoPrint = factory(window.$, window._);
global.OctoPrint = factory(global.$, global._);
}
})(window || this, function($, _) {
})(this, function($, _) {
var OctoPrint = {};
var noCache = function(opts) {

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var loginUrl = "api/login";
var logoutUrl = "api/logout";
@ -26,4 +26,6 @@
return OctoPrint.postJson(logoutUrl, {}, opts);
}
};
return OctoPrint.browser;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var url = "api/connection";
OctoPrint.connection = {
@ -23,5 +23,7 @@
fakeAck: function(opts) {
return OctoPrint.issueCommand(url, "fake_ack", {}, opts);
}
}
};
return OctoPrint.connection;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var customUrl = "api/printer/command/custom";
var commandUrl = "api/printer/command";
@ -49,5 +49,7 @@
sendGcodeScript: function (script, context, opts) {
return sendGcodeScriptWithParameters(script, context, undefined, opts);
}
}
};
return OctoPrint.control;
});

View file

@ -1,13 +1,10 @@
(function (factory) {
'use strict';
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define(["OctoPrint", "jquery", "lodash"], factory);
} else {
// Browser globals:
factory(window.OctoPrint, window.jQuery, window._);
factory(global.OctoPrint, global.$, global._);
}
})(function(OctoPrint, $, _) {
})(this, function(OctoPrint, $, _) {
var url = "api/files";
var downloadUrl = "downloads/files";
@ -188,5 +185,7 @@
log.warn("OctoPrint.files.elementByPath has been renamed to OctoPrint.files.entryForPath, please use that instead");
return entryForPath(location, startElement);
}
}
};
return OctoPrint.files;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var url = "api/job";
var issueCommand = function(command, payload, opts) {
@ -38,5 +38,7 @@
cancel: function(opts) {
return issueCommand("cancel", opts);
}
}
};
return OctoPrint.job;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var url = "api/languages";
OctoPrint.languages = {
@ -19,4 +19,6 @@
return OctoPrint.delete(packUrl, opts);
}
};
return OctoPrint.languages;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var url = "api/logs";
OctoPrint.logs = {
@ -21,5 +21,7 @@
var fileUrl = url + "/" + file;
return OctoPrint.download(fileUrl, opts);
}
}
};
return OctoPrint.logs;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var url = "api/printer";
var printheadUrl = url + "/printhead";
var toolUrl = url + "/tool";
@ -206,5 +206,7 @@
releaseSd: function (opts) {
return issueSdCommand("release", {}, opts);
}
}
};
return OctoPrint.printer;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint", "jquery"], factory);
} else {
factory(window.OctoPrint, window.$);
factory(global.OctoPrint, global.$);
}
})(window || this, function(OctoPrint, $) {
})(this, function(OctoPrint, $) {
var url = "api/printerprofiles";
var profileUrl = function(profile) {
@ -42,5 +42,7 @@
delete: function (id, opts) {
return OctoPrint.delete(profileUrl(id), opts);
}
}
};
return OctoPrint.printerprofiles;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint", "jquery"], factory);
} else {
factory(window.OctoPrint, window.$);
factory(global.OctoPrint, global.$);
}
})(window || this, function(OctoPrint, $) {
})(this, function(OctoPrint, $) {
var url = "api/settings";
var get = function(opts) {
@ -39,5 +39,7 @@
data["plugins"][plugin] = settings;
return save(data, opts);
}
}
};
return OctoPrint.settings;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var url = "api/slicing";
var slicerUrl = function(slicer) {
@ -41,5 +41,7 @@
deleteProfileForSlicer: function(slicer, profileId, opts) {
return OctoPrint.delete(profileUrl(slicer, profileId), opts);
}
}
};
return OctoPrint.slicing;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint", "jquery", "lodash", "sockjs"], factory);
} else {
factory(window.OctoPrint, window.$, window._, window.SockJS);
factory(global.OctoPrint, global.$, global._, global.SockJS);
}
})(window || this, function(OctoPrint, $, _, SockJS) {
})(this, function(OctoPrint, $, _, SockJS) {
var exports = {};
exports.options = {
@ -172,4 +172,6 @@
exports.sendMessage = sendMessage;
OctoPrint.socket = exports;
return OctoPrint.socket;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var url = "api/system";
var commandUrl = "api/system/commands";
@ -21,4 +21,6 @@
return OctoPrint.postJson(commandUrl + "/" + source + "/" + action, {}, opts);
}
};
return OctoPrint.system;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint", "jquery"], factory);
} else {
factory(window.OctoPrint, window.$);
factory(global.OctoPrint, global.$);
}
})(window || this, function(OctoPrint, $) {
})(this, function(OctoPrint, $) {
var url = "api/timelapse";
var downloadUrl = "downloads/timelapse";
@ -109,5 +109,7 @@
config = config || {};
return OctoPrint.postJson(url, config, opts);
}
}
};
return OctoPrint.timelapse;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var baseUrl = "api/users";
var url = function() {
@ -107,4 +107,6 @@
return OctoPrint.patchJson(url(name, "settings"), settings, opts);
}
};
return OctoPrint.users;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint", "jquery"], factory);
} else {
factory(window.OctoPrint, window.$);
factory(global.OctoPrint, global.$);
}
})(window || this, function(OctoPrint, $) {
})(this, function(OctoPrint, $) {
var url = "api/util";
var testUrl = url + "/test";
@ -44,4 +44,6 @@
return test("url", data, opts);
}
};
return OctoPrint.util;
});

View file

@ -2,9 +2,9 @@
if (typeof define === "function" && define.amd) {
define(["OctoPrint"], factory);
} else {
factory(window.OctoPrint);
factory(global.OctoPrint);
}
})(window || this, function(OctoPrint) {
})(this, function(OctoPrint) {
var url = "api/setup/wizard";
OctoPrint.wizard = {
@ -15,4 +15,6 @@
return OctoPrint.postJson(url, {handled: handled || []}, opts);
}
};
return OctoPrint.wizard;
});