1.1.3 • Published 10 months ago

@blackglory/go v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

go

Install

npm install --save @blackglory/go
# or
yarn add @blackglory/go

Usage

import { go } from '@blackglory/go'

go(async () => {
  ...
})

Why?

IIFE is good until you forget to invoke it:

;(async () => {
  ...
}) // oops!

The semicolon-free style is good until you forget to add a semicolon before the IIFE:

const arr = []

// oops!
(async () => {
  ...
})()

API

go

function go<T>(fn: () => T): T

goMicrotask

function goMicrotask<T>(fn: () => Awaitable<T>): Promise<T>

goMarcotask

function goMarcotask<T>(fn: () => Awaitable<T>): Promise<T>