Logo Xantham

BrowserBindings Module

The compiler-lib names the `Fable.Browser.*` family binds - the DOM half of the same disposition `LibBindings` covers for the ECMAScript half. The table itself is generated (`BrowserBindingTable`, from `tools/browser-gen/generate.fsx`), because it is four hundred names read off two authorities that both move: what the referenced `Browser.*` assemblies export, and what the pinned compiler's `lib.*.d.ts` files declare. Only their intersection is here, so an entry is by construction a real lib name with a real binding. The *rule* below is hand-written and tested, next to the one it mirrors. Arity is a lookup key rather than a property of the name, which is where this rule and `LibBindings` differ: `CustomEvent` is bound both bare and generic, so a reference carrying one type argument should reach the generic binding and a bare one the other. Failing an exact match, the widest binding the reference has arguments for wins and the extras are dropped with a finding - `LibBindings`' rule, generalised. A reference with fewer arguments than the narrowest binding is some other type wearing a familiar name, and widens. Unlike `LibBindings` no entry carries a loss note: a `Browser.Types` name is the same type under a different spelling, so the mapping is Exact. Whether Fable's binding has caught up with the member the caller wants is that package's business, exactly as it is for `JS.Promise`.

Functions and values

Function or value Description

tryFind name argumentCount

Full Usage: tryFind name argumentCount

Parameters:
    name : string
    argumentCount : int

Returns: (string * int) option

The binding for a lib name at a reference carrying `argumentCount` type arguments: its F# name and the arity that name takes.

name : string
argumentCount : int
Returns: (string * int) option

Type something to start searching.