"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/node_modules/once/once.js" (8 Mar 2017, 417 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 }