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

Pending(Get|Post)Beacon vs PendingBeacon("(Get|Post)", .... #59

Closed
sefeng211 opened this issue Nov 21, 2022 · 3 comments
Closed

Pending(Get|Post)Beacon vs PendingBeacon("(Get|Post)", .... #59

sefeng211 opened this issue Nov 21, 2022 · 3 comments

Comments

@sefeng211
Copy link

Have we considered to shape the API as PendingBeacon("Get", ...) and PendingBeacon("Post", ...)? This would match what the fetch and XHR do. It seems uncommon with the current setup.

@mingyc
Copy link
Collaborator

mingyc commented Nov 24, 2022

cc @fergald
It is mainly for easier type safety to make the API shape look like this.

@fergald
Copy link
Collaborator

fergald commented Nov 24, 2022

If we made them the same class then we would have to specify that certain methods (like setUrl or setData) will raise exceptions when called on the wrong kind. Making them different classes avoids that and for typescript coders, it becomes a compile-time error to call setUrl of a POST beacon.

@mingyc
Copy link
Collaborator

mingyc commented Nov 13, 2023

The API is now repurposed as fetchLater() which supports both HTTP methods. whatwg/fetch#1647

@mingyc mingyc closed this as completed Nov 13, 2023
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

3 participants