secretlyRequest

静默请求

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/373955/642317/secretlyRequest.js

// ==UserScript==
// @name         secretlyRequest
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  静默请求
// @author       You
// @grant        none
// ==/UserScript==
(function () {
    const requset = (url) => {
        return new Promise((resolve, reject) => {
            const img = new Image;
            img.onload = () => {
                resolve(0);
            };
            img.onerror = (err) => {
                resolve(1);
            };
            img.src = url;
        });
    };

    window.H = window.H || {};
    window.H.secretlyRequest = requset;
})();