r-async-value
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

AsyncValue

An ADT for representing an async value over time

const asyncTodos: AsyncValue<Error, Todo[]> = notAsked

async function loadTodos() {
    asyncTodos = pending
    try {
        const todos = await fetchTodos()
        asyncTodos = success(todos)
    } catch (reason) {
        asyncTodos = failure(reason)
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i r-async-value

Weekly Downloads

4

Version

0.0.1

License

none

Unpacked Size

21.8 kB

Total Files

13

Last publish

Collaborators

  • rozaxe