projects
/
platform
/
framework
/
web
/
crosswalk-tizen.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
2e1e721bfecec364ca8a6aab8a261067a2c74716
[platform/framework/web/crosswalk-tizen.git]
/
1
var wrappy = require('wrappy')
2
module.exports = wrappy(once)
3
4
once.proto = once(function () {
5
Object.defineProperty(Function.prototype, 'once', {
6
value: function () {
7
return once(this)
8
},
9
configurable: true
10
})
11
})
12
13
function once (fn) {
14
var f = function () {
15
if (f.called) return f.value
16
f.called = true
17
return f.value = fn.apply(this, arguments)
18
}
19
f.called = false
20
return f
21
}