fable-browser
Fable bindings for Browser Web APIs
NuGet | Name | Description |
---|---|---|
Fable.Browser.Blob | Bindings for the browser Blob API. | |
Fable.Browser.Dom | Bindings for DOM and HTML interfaces | |
Fable.Browser.Event | Bindings for the browser Event interface | |
Fable.Browser.Performance | Bindings for the browser Performance API | |
Fable.Browser.Url | Bindings for the browser Url API | |
Fable.Browser.WebSocket | Bindings for the browser WebSocket API | |
Fable.Browser.WebRTC | Bindings for the browser WebRTC API | |
Fable.Browser.WebStorage | Bindings for the Web Storage API | |
Fable.Browser.XMLHttpRequest | Bindings for the browser XMLHttpRequest API | |
Fable.Browser.Svg | Bindings for the browser Svg API | |
Fable.Browser.Css | Bindings for the browser Css API | |
Fable.Browser.Worker | Bindings for the browser Worker API | |
Fable.Browser.Geolocation | Bindings for the browser Geolocation API | |
Fable.Browser.Navigator | Bindings for the browser Navigator API | |
Fable.Browser.MediaStream | Bindings for the browser MediaStream API | |
Fable.Browser.MediaRecorder | Bindings for the browser MediaRecorder API | |
Fable.Browser.MediaQueryList | Bindings for the browser MediaQueryList API | |
Fable.Browser.WebGL | Bindings for the browser WebGL API |
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
packages
list of the Build.fsx script