MCPcopy Create free account
hub / github.com/Moli-X/Resources / notify

Method notify

Script/Hzh.js:458–498  ·  view source on GitHub ↗
(title, subtitle = "", content = "", options = {})

Source from the content-addressed store, hash-verified

456
457 // notification
458 notify(title, subtitle = "", content = "", options = {}) {
459 const openURL = options["open-url"];
460 const mediaURL = options["media-url"];
461
462 if (isQX) $notify(title, subtitle, content, options);
463 if (isSurge) {
464 $notification.post(
465 title,
466 subtitle,
467 content + `${mediaURL ? "\n多媒体:" + mediaURL : ""}`,
468 {
469 url: openURL,
470 }
471 );
472 }
473 if (isLoon) {
474 let opts = {};
475 if (openURL) opts["openUrl"] = openURL;
476 if (mediaURL) opts["mediaUrl"] = mediaURL;
477 if (JSON.stringify(opts) === "{}") {
478 $notification.post(title, subtitle, content);
479 } else {
480 $notification.post(title, subtitle, content, opts);
481 }
482 }
483 if (isNode || isScriptable) {
484 const content_ =
485 content +
486 (openURL ? `\n点击跳转: ${openURL}` : "") +
487 (mediaURL ? `\n多媒体: ${mediaURL}` : "");
488 if (isJSBox) {
489 const push = require("push");
490 push.schedule({
491 title: title,
492 body: (subtitle ? subtitle + "\n" : "") + content_,
493 });
494 } else {
495 console.log(`${title}\n${subtitle}\n${content_}\n\n`);
496 }
497 }
498 }
499
500 // other helper functions
501 log(msg) {

Callers 12

Hzh.jsFile · 0.45
showmsgFunction · 0.45
getCookieFunction · 0.45
_produceArtifactFunction · 0.45
_downloadSubscriptionFunction · 0.45
_downloadCollectionFunction · 0.45
TBPrice.jsFile · 0.45
_produceArtifactFunction · 0.45
_doSyncFunction · 0.45
_produceArtifactFunction · 0.45
_downloadSubscriptionFunction · 0.45
_downloadCollectionFunction · 0.45

Calls 4

$notifyFunction · 0.70
postMethod · 0.45
stringifyMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected