PushCat

2023年04月09日 に作成
9ヶ月前 に更新
PushCat调用库
総インストール数
12,143
今日の新規
+3
ユーザー評価
- / 5.0 (0)
現在のバージョン
1.0.2
// @require https://scriptcat.org/lib/946/1.0.2/PushCat.js?sha384-oSlgx/WB23lLz4OArRxG+kpIkZnfokQmTboHl4CT/yG38oxllL9+O+bo7K2Icrja
ライブラリ詳細
これはユーザースクリプトが使用するライブラリです。スクリプト内で直接参照できます。

待补充

// ==UserScript==
// @name         PushCat浏览器端
// @namespace    https://bbs.tampermonkey.net.cn/
// @version      0.1.0
// @description  PushCat浏览器端,可作为接收设备通知,也可以作为发送端推送消息至其它设备
// @author       王一之
// @background
// @connect      sct.icodef.com
// @grant GM_notification
// @grant GM_xmlhttpRequest
// @require https://scriptcat.org/lib/946/%5E1.0.1/PushCat.js
// ==/UserScript==

const device = new PushCatDevice({
    name: "浏览器",
    accessKey: "jz5ud0hda4ahy9qp",
});

device.onError(data => {
    GM_notification({
        title: "设备注册失败",
        text: data.msg,
    })
});

device.onMessage(messages => {
    messages.forEach(msg => {
        GM_notification({
            title: msg.title,
            text: msg.content
        })
    });
});

// const push = new PushCat({
//     accessKey: "jz5ud0hda4ahy9qp",
// });

// push.send("title", "content");