fable-browser
fable-browser copied to clipboard
Fable bindings for Browser Web APIs
fable-browser
Fable bindings for Browser Web APIs
Usage
After installing one of the Nuget packages you can access the API. For that, you only need to open the Browser namespace.
open Browser
let fooEl = document.getElementById("foo")
Note the API values are actually contained in an [<AutoOpen>] module, so if you need to fully qualify the value to avoid name conflicts, use the full module name (same as the Nuget package without Fable. prefix):
let fooEl = Browser.Dom.document.getElementById("foo")
If you need to reference one of the types in the package, open the Browser.Types namespace:
open Browser.Types
let handleClick (ev: MouseEvent) = printfn "click!"
Publishing
If you have rights to publish the packages, the only thing you need to do is to bump the version in the appropriate RELEASE_NOTES file and then run npm run publish. The build script will automatically detect what packages have new versions, update the .fsproj file and push a release. Just make sure:
- Your Nuget API key is in a FABLE_NUGET_KEY environmental variable
- The packages you want to publish are listed in the
packageslist of the Build.fsx script