MCPcopy Create free account
hub / github.com/ygs-code/vue / createOnceHandler

Function createOnceHandler

vue.js:10424–10441  ·  view source on GitHub ↗
(
        handler,//转义过的事件
        event, //事件名称
        capture  // 事件俘获或是冒泡行为
    )

Source from the content-addressed store, hash-verified

10422 //柯理化函数,返回一个直接调用函数的方法,调用完就删除事件
10423
10424 function createOnceHandler(
10425 handler,//转义过的事件
10426 event, //事件名称
10427 capture // 事件俘获或是冒泡行为
10428 ) {
10429 var _target = target$1; // save current target element in closure
10430 return function onceHandler() {
10431 var res = handler.apply(null, arguments);
10432 if (res !== null) {
10433 remove$2(
10434 event, //事件名称
10435 onceHandler, //绑定的事件
10436 capture, //事件俘获或是冒泡行为
10437 _target //真实的dom
10438 );
10439 }
10440 }
10441 }
10442
10443
10444 //withMacroTask,为事件添加一个静态属性_withTask为红任务,则是执行fn的。

Callers 1

add$1Function · 0.85

Calls 1

remove$2Function · 0.85

Tested by

no test coverage detected