MCPcopy
hub / github.com/ygs-code/vue / once

Function once

vue.js:481–489  ·  view source on GitHub ↗

* Ensure a function is called only once. * 确保该函数只调用一次 闭包函数

(fn)

Source from the content-addressed store, hash-verified

479 * 确保该函数只调用一次 闭包函数
480 */
481 function once(fn) {
482 var called = false;
483 return function () {
484 if (!called) {
485 called = true;
486 fn.apply(this, arguments);
487 }
488 }
489 }
490
491 //ssr标记属性
492 var SSR_ATTR = 'data-server-rendered';

Callers 3

resolveAsyncComponentFunction · 0.85
enterFunction · 0.85
leaveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected