Package Exports
- @blackglory/go
- @blackglory/go/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@blackglory/go) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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>
goGenerator
function goGenerator<Yield, Next>(
fn: () =>
| void
| Generator<Yield, void, Next>
): Generator<Yield, void, Next>
goAsyncGenerator
function goAsyncGenerator<Yield, Next>(
fn: () =>
| void
| Generator<Yield, void, Next>
| AsyncGenerator<Yield, void, Next>
): AsyncGenerator<Yield, void, Next>