File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 1+ // taken from
2+ // <https://github.com/ghcjs/ghcjs-base/blob/eacf95aac3061275699563e1802eabe4a8f4aaec/jsbits/xhr.js>
3+ // see that page for license
4+
5+ function h$solgaSendXHR ( xhr , d , cont ) {
6+ xhr . addEventListener ( 'error' , function ( ) {
7+ cont ( 2 ) ;
8+ } ) ;
9+ xhr . addEventListener ( 'abort' , function ( ) {
10+ cont ( 1 ) ;
11+ } ) ;
12+ xhr . addEventListener ( 'load' , function ( ) {
13+ cont ( 0 ) ;
14+ } ) ;
15+ if ( d ) {
16+ xhr . send ( d ) ;
17+ } else {
18+ xhr . send ( ) ;
19+ }
20+ }
21+
Original file line number Diff line number Diff line change @@ -25,3 +25,4 @@ library
2525 hs-source-dirs : src
2626 default-language : Haskell2010
2727 ghc-options : -Wall
28+ js-sources : jsbits/xhr.js
Original file line number Diff line number Diff line change @@ -170,10 +170,10 @@ data XHRError =
170170newtype GetResponse a b = GetResponse { unGetResponse :: Either XHRError (Response a ) -> IO b }
171171
172172foreign import javascript interruptible
173- " h$anapoSendXHR ($1, null, $c);"
173+ " h$solgaSendXHR ($1, null, $c);"
174174 js_send0 :: DOM. XMLHttpRequest -> IO Int
175175foreign import javascript interruptible
176- " h$anapoSendXHR ($1, $2, $c);"
176+ " h$solgaSendXHR ($1, $2, $c);"
177177 js_send1 :: DOM. XMLHttpRequest -> DOM. JSVal -> IO Int
178178
179179performXHR :: DOM. XMLHttpRequestResponseType -> Request -> IO (Either XHRError (Response DOM. JSVal ))
You can’t perform that action at this time.
0 commit comments