Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why Navigator.sendBeacon() is a TODO? #60

Open
kittipatv opened this issue Apr 3, 2021 · 1 comment
Open

Why Navigator.sendBeacon() is a TODO? #60

kittipatv opened this issue Apr 3, 2021 · 1 comment

Comments

@kittipatv
Copy link

kittipatv commented Apr 3, 2021

Hi,
What is the reason that Navigator.sendBeacon() is not available? I'm new to Fable (and F#) but the method signature looks simple. Can this be added?

https://github.com/fable-compiler/fable-browser/blob/master/src/Navigator/Browser.Navigator.fs#L135

@alfonsogarciacaro
Copy link
Member

Hmm, tbh I don't remember 😅 Probably because I was updating the package noticed the API and was in doubt if the second data argument should be typed somehow or just obj. It accepts so many cases, that obj is probably fine, although I don't remember if we have a consistent approach for these cases in the repo. If you want to send a PR, ,aybe we can add it as:

abstract sendBeacon: url: string * ?data: obj -> unit

BTW, reporting missing APIs is very helpful. But in the case you need it and cannot wait for a new release you can use an extension:

open Fable.Core
open Browser.Types

type Navigator with
    [<Emit("$0.sendBeacon($1...)")>]
    member _.sendBeacon(url: string, ?data: obj): bool = jsNative

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants