MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / once

Function once

ui/plugins/ui/jasmine/jasmine.js:6961–6975  ·  view source on GitHub ↗
(fn, onTwice)

Source from the content-addressed store, hash-verified

6959 j$.StopExecutionError = StopExecutionError
6960
6961 function once(fn, onTwice) {
6962 let called = false
6963 return function(arg) {
6964 if (called) {
6965 if (onTwice) {
6966 onTwice()
6967 }
6968 } else {
6969 called = true
6970 // Direct call using single parameter, because cleanup/next does not need more
6971 fn(arg)
6972 }
6973 return null
6974 }
6975 }
6976
6977 function fallbackOnMultipleDone() {
6978 console.error(

Callers 1

jasmine.jsFile · 0.85

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected