pinafore/routes/_utils/thunk.js

11 lines
156 B
JavaScript
Raw Normal View History

2018-02-22 01:52:33 +00:00
export function thunk(fn) {
let value
let called
return () => {
if (!called) {
value = fn()
called = true
}
return value
}
}