跳转到内容

MediaWiki:Gadget-libRequestAnimationFrame.js

来自萌娘共享

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/libRequestAnimationFrame/Gadget-libRequestAnimationFrame.js|user=[[U:AnnAngela]]|co-authors=|longId=0ff558e4c2cac4cc834bc46d14a9fa1eb445b154|shortId=0ff558e4|summary=feat(Gadget/libRequestAnimationFrame): 添加 libRequestAnimationFrame 类及其定义文件}}'; 

/* <pre> */

"use strict";var __classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(e,t,i,a){if("a"===i&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?a:"a"===i?a.call(e):a?a.value:t.get(e)},__classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(e,t,i,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,i):r?r.value=i:t.set(e,i),i};(()=>{var e,t;class LibRequestAnimationFrame{constructor(){e.set(this,null),t.set(this,new Set)}request(i){return __classPrivateFieldGet(this,t,"f").add(i),null===__classPrivateFieldGet(this,e,"f")&&__classPrivateFieldSet(this,e,window.requestAnimationFrame((...i)=>{__classPrivateFieldGet(this,t,"f").forEach(e=>e(...i)),__classPrivateFieldSet(this,e,null,"f"),__classPrivateFieldGet(this,t,"f").clear()}),"f"),__classPrivateFieldGet(this,e,"f")}cancel(){null!==__classPrivateFieldGet(this,e,"f")&&(window.cancelAnimationFrame(__classPrivateFieldGet(this,e,"f")),__classPrivateFieldSet(this,e,null,"f"))}}e=new WeakMap,t=new WeakMap;const i=new LibRequestAnimationFrame;window.libRequestAnimationFrame={LibRequestAnimationFrame,requestAnimationFrameOnce:e=>i.request(e)}})(); 

/* </pre> */