deferred

package
v0.0.0-...-674084c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package deferred has machinery for providing JavaScript with deferred values. These arise because we want to have library functions for JavaScript to request things that will only later be supplied -- either because it will take some time to get, and it's better if JavaScript doesn't have to block (e.g., an HTTP request), or because we're waiting for something elsewhere to happen (e.g., watching a resource for changes).

In JavaScript, deferred values will often end up being represented by promises; but the protocol allows other representations, and in particular, some requests may result in an sequence of values rather than just a single value. The protocol also allows for cancelling a deferred value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wait

func Wait()

Wait blocks until all outstanding deferred values in the global scheduler are fulfilled.

Types

type Serial

type Serial uint64

Serial is a serial number used to identify deferreds between Go and JavaScript.

func Register

func Register(p performFunc, r resolver) Serial

Register schedules an action to be performed later, with the result sent to `resolver`, using the global deferred scheduler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL