1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/once/once.js

22 lines
417 B
JavaScript
Raw Normal View History

2023-12-18 13:12:25 +08:00
var wrappy = require('wrappy')
module.exports = wrappy(once)
once.proto = once(function () {
Object.defineProperty(Function.prototype, 'once', {
value: function () {
return once(this)
},
configurable: true
})
})
function once (fn) {
var f = function () {
if (f.called) return f.value
f.called = true
return f.value = fn.apply(this, arguments)
}
f.called = false
return f
}