MCPcopy Index your code
hub / github.com/Moli-X/Resources / constructor

Method constructor

Script/Hzh.js:302–332  ·  view source on GitHub ↗
(name, debug)

Source from the content-addressed store, hash-verified

300 const { isQX, isLoon, isSurge, isNode, isJSBox, isScriptable } = ENV();
301 return new (class {
302 constructor(name, debug) {
303 this.name = name;
304 this.debug = debug;
305
306 this.http = HTTP();
307 this.env = ENV();
308
309 this.node = (() => {
310 if (isNode) {
311 const fs = require("fs");
312
313 return {
314 fs,
315 };
316 } else {
317 return null;
318 }
319 })();
320 this.initCache();
321
322 const delay = (t, v) =>
323 new Promise(function (resolve) {
324 setTimeout(resolve.bind(null, v), t);
325 });
326
327 Promise.prototype.delay = function (t) {
328 return this.then(function (v) {
329 return delay(t, v);
330 });
331 };
332 }
333
334 // persistence
335 // initialize cache

Callers

nothing calls this directly

Calls 4

initCacheMethod · 0.80
HTTPFunction · 0.70
ENVFunction · 0.70
delayFunction · 0.70

Tested by

no test coverage detected