Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/easy_std/src/fn.ts>useOnce

Generic Deno standard library, focused on ease of use | 通用 Deno 标准库,专注于易用性
Go to Latest
function useOnce
import { useOnce } from "https://deno.land/x/easy_std@v0.7.0/src/fn.ts";

Any function will only be called once

Examples

Example 1

import { useOnce } from "https://deno.land/x/easy_std@version/src/fn.ts"

let foo = 0

const once = useOnce(() => foo += 1)

once()
once()

foo // 1