Skip to content

Conversation

@dsmatter
Copy link

Proposed fix for #50.

Adds two new public functions: customAffjax and customAffjax' which allow the underlying XHR to be inspected/manipulated before it is sent. This makes it possible to add an event listener for the progress event, for example.

To enable this, execution of the XHR was divided into three stages:

  • preparing,
  • callback wiring,
  • sending.

- Separate executing an XHR into 3 stages:
  - preparing
  - callback wiring
  - sending
- Allow the underlying XHR to be manipulated before it is sent
@damncabbage
Copy link
Contributor

damncabbage commented Dec 5, 2016

Bump; would the idea of this still be useful?

(I found this issue while trying to figure out how to get timeouts working, eg. via ontimeout; requests stay stuck in Pending forever in some situations. I'll ping this as related when I write it up.)

@thomashoneyman thomashoneyman changed the base branch from master to main October 6, 2020 02:53
@jamesdbrock
Copy link
Member

This PR would have been helpful to me. Why wasn't it merged? Just because of the CLA, or for some other reason?

@garyb
Copy link
Member

garyb commented Feb 24, 2021

I think, at the time, I was concerned about adding features that wouldn't also work correctly on Node.

Later, I wanted to do something that provided the Affjax interface and you would choose a "driver" or something for it that explicitly determined whether it was for Node or XHR. I haven't spent the time to figure that out still.

Nowadays, there's also purescript-web-xhr if you want to do things that fall outside of Affjax's capabilities.

edit: The CLA thing was a requirement when this library was under slamdata.

@JordanMartinez
Copy link
Contributor

I say we close this PR. Ideally, affjax would be built on fetch.

@JordanMartinez
Copy link
Contributor

@garyb How does this factor into #171 and the driver split we're currently doing?

@garyb
Copy link
Member

garyb commented Mar 29, 2022

I think what I said above is still right, and it's not something we need to do here.

There's maybe something that could be done in the driver repo(s) that would allow extra capabilities (pass something in when "creating" a driver value - maybe it's like (XMLHttpRequest res -> Effect (XMLHttpRequest res)) -> AffjaxDriver or something for the web affjax driver, and then explicitly pass that into the non-driver affjax functions), but there other library options for needs outside of Affjax's interface.

I'll close this because of that.

@garyb garyb closed this Mar 29, 2022
@JordanMartinez
Copy link
Contributor

Another option is to increase the driver interface, passing in Nothing for options not supported in that environment or options one doesn't want to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants