User:Evad37/sandbox/ModularUserscriptBase/sandbox.js

(function{function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})({1:[function(require,module,exports){ "use strict";

var _App = _interopRequireDefault(require("./modules/App"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

Promise.all([// Resource loader modules mw.loader.using(['mediawiki.util', 'mediawiki.api', 'mediawiki.Title']), // Page ready $.ready]).then(function {  (0, _App["default"]); });

},{"./modules/App":2}],2:[function(require,module,exports){ "use strict";

Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0;

var _hello = _interopRequireDefault(require("./hello"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var App = function App { // Example: Using a custom module (imported above) var helloTo = "me"; var greeting1 = (0, _hello["default"])(helloTo); console.log("greeting1", greeting1); var greeting2 = (0, _hello["default"]); console.log({   greeting2: greeting2  }); // Example: Using a MedaiWiki ResourceLoader module (loaded in index.js)

var api = new mw.Api; var id = mw.config.get('wgArticleId'); api.get({   action: 'query',    pageids: id,    prop: ['revisions', 'info'],    rvprop: ['user', 'content'],    rvlimit: 1,    rvdir: 'newer'  }).then(function (response) {    console.log("response", response);  }); };

var _default = App; exports["default"] = _default;

},{"./hello":3}],3:[function(require,module,exports){ "use strict";

Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0;

var hello = function hello(name) { return "Hello, " + name || "world"; };

var _default = hello; exports["default"] = _default;

},{}]},{},[1]) //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZG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