(fn, onTwice)
| 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( |