Async xmlhttprequest

封装 GM_xmlhttprequest

Verze ze dne 11. 07. 2021. Zobrazit nejnovější verzi.

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.greatest.deepsurf.us/scripts/429203/949224/Async%20xmlhttprequest.js

  1. // ==UserScript==
  2. // @name Async xmlhttprequest
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.1
  5. // @description 封装 GM_xmlhttprequest
  6. // @author LinHQ
  7. // @match *
  8. // @grant GM_xmlhttprequest
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. function req(details){
  14. return new Promise((res, rej) => {
  15. details.onload = res;
  16. details.ontimeout = rej;
  17. details.onabort = rej;
  18. details.onerror = rej;
  19.  
  20. GM_xmlhttpRequest(
  21. details
  22. );
  23. });
  24. }
  25. })();