diff --git a/.npmignore b/.npmignore index 166b8e8..3a5ca5b 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,7 @@ *~ .babelrc -.eslintrc .eslintignore +.eslintrc .nyc_output .prettierrc .travis.yml @@ -9,6 +9,7 @@ bench bower.json coverage docs +klipse-github-docs.config.js rollup.config.js scripts test diff --git a/README.md b/README.md index 58021f9..d783615 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [≡](#contents) Karet XHR · [![Gitter](https://img.shields.io/gitter/room/calmm-js/chat.js.svg)](https://gitter.im/calmm-js/chat) [![GitHub stars](https://img.shields.io/github/stars/calmm-js/karet.xhr.svg?style=social)](https://github.com/calmm-js/karet.xhr) +# Karet XHR · [![Gitter](https://img.shields.io/gitter/room/calmm-js/chat.js.svg)](https://gitter.im/calmm-js/chat) [![GitHub stars](https://img.shields.io/github/stars/calmm-js/karet.xhr.svg?style=social)](https://github.com/calmm-js/karet.xhr) This library provides a thin wrapper over the standard [`XMLHttpRequest`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) @@ -23,7 +23,7 @@ Examples: [![](https://david-dm.org/calmm-js/karet.xhr.svg)](https://david-dm.org/calmm-js/karet.xhr) [![](https://david-dm.org/calmm-js/karet.xhr/dev-status.svg)](https://david-dm.org/calmm-js/karet.xhr?type=dev) -## [≡](#contents) Contents +## [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#contents) Contents * [Reference](#reference) * [Convenience](#convenience) @@ -72,12 +72,12 @@ Examples: * [Auxiliary](#auxiliary) * [`XHR.isHttpSuccess(number) ~> boolean`](#XHR-isHttpSuccess) -## [≡](#contents) Reference +## [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#reference) Reference The interface of this library consists of named exports. Typically one just imports the library as: -```js +```jsx import * as XHR from 'karet.xhr' ``` @@ -88,20 +88,20 @@ using [`XHR.perform`](#XHR-perform) and then observes the ongoing XHR state using the accessors for [overall](#overall-state), [download](#download-state), and [upload](#upload-state) state. -### [≡](#contents) [Convenience](#convenience) +### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#convenience) [Convenience](#convenience) -#### [≡](#contents) [`XHR.getJson(url | {url,[, ...]}) ~> varies`](#XHR-getJson) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-getJson) [`XHR.getJson(url | {url,[, ...]}) ~> varies`](#XHR-getJson) `XHR.getJson(arg)` is shorthand for [`XHR.responseFull(XHR.performJson(arg))`](#XHR-responseFull). See also [`XHR.performJson`](#XHR-performJson). -#### [≡](#contents) [`XHR.performJson(url | {url[, ...]}) ~> xhr`](#XHR-performJson) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-peformJson) [`XHR.performJson(url | {url[, ...]}) ~> xhr`](#XHR-performJson) `XHR.performJson` is shorthand for [`XHR.performWith({responseType: 'json'})`](#XHR-performWith). -#### [≡](#contents) [`XHR.performWith(url | {...}, url | {...}) ~> xhr`](#XHR-performWith) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-performWith) [`XHR.performWith(url | {...}, url | {...}) ~> xhr`](#XHR-performWith) `XHR.performWith` is a curried function that allows one to define a [`XHR.perform`](#XHR-perform) like function with default parameters. See @@ -109,15 +109,15 @@ and [upload](#upload-state) state. For example: -```js +```jsx const get = XHR.performWith({responseType: 'json', timeout: 30*1000}) // ... get(url) ``` -### [≡](#contents) [Starting](#starting) +### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#starting) [Starting](#starting) -#### [≡](#contents) [`XHR.perform(url | {url[, method, user, password, headers, overrideMimeType, body, responseType, timeout, withCredentials]}) ~> xhr`](#XHR-perform) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-perform) [`XHR.perform(url | {url[, method, user, password, headers, overrideMimeType, body, responseType, timeout, withCredentials]}) ~> xhr`](#XHR-perform) `XHR.perform` creates an observable [property](https://kefirjs.github.io/kefir/#about-observables) that represents @@ -162,9 +162,9 @@ parse, then [`XHR.response`](#XHR-response) and See this live [GitHub repository search](https://codesandbox.io/s/l5271q0r2l) CodeSandbox for an example. -### [≡](#contents) [Overall state](#overall-state) +### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#overall-state) [Overall state](#overall-state) -#### [≡](#contents) [`XHR.allResponseHeaders(xhr) ~> string`](#XHR-allResponseHeaders) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-allResponseHeaders) [`XHR.allResponseHeaders(xhr) ~> string`](#XHR-allResponseHeaders) `XHR.allResponseHeaders` returns a possibly observable property that emits the value of @@ -172,31 +172,31 @@ value of after the HTTP headers have been received. When called on a non-observable XHR, its [`readyState` must be 2](#XHR-headersReceived) or an `Error` will be thrown. -#### [≡](#contents) [`XHR.headersReceived(xhr) ~> boolean`](#XHR-headersReceived) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-headersReceived) [`XHR.headersReceived(xhr) ~> boolean`](#XHR-headersReceived) `XHR.headersReceived` returns a possibly observable boolean property that tells whether HTTP headers have been received and can be obtained using [`XHR.allResponseHeaders`](#XHR-allResponseHeaders) or [`XHR.responseHeader`](#XHR-responseHeader). -#### [≡](#contents) [`XHR.isDone(xhr) ~> boolean`](#XHR-isDone) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-isDone) [`XHR.isDone(xhr) ~> boolean`](#XHR-isDone) `XHR.isDone` returns a possibly observable boolean property that tells whether the XHR operation is complete (whether success or failure). -#### [≡](#contents) [`XHR.readyState(xhr) ~> number`](#XHR-readyState) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-readyState) [`XHR.readyState(xhr) ~> number`](#XHR-readyState) `XHR.readyState` returns a possibly observable property of the [`readyState`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState) of an ongoing XHR. -#### [≡](#contents) [`XHR.response(xhr) ~> varies`](#XHR-response) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-response) [`XHR.response(xhr) ~> varies`](#XHR-response) `XHR.response` returns a possibly observable property of the [`response`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/response) of an ongoing XHR. See also [`XHR.responseFull`](#XHR-responseFull). -#### [≡](#contents) [`XHR.responseFull(xhr) ~> varies`](#XHR-responseFull) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-responseFull) [`XHR.responseFull(xhr) ~> varies`](#XHR-responseFull) `XHR.responseFull` returns a possibly observable property that emits the [`response`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/response) @@ -204,7 +204,7 @@ after the XHR has completed. When called on a non-observable XHR, its [`readyState` must be 4](#XHR-isDone) or an `Error` will be thrown. See also [`XHR.response`](#XHR-response). -#### [≡](#contents) [`XHR.responseHeader(header, xhr) ~> string`](#XHR-responseHeader) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-responseHeader) [`XHR.responseHeader(header, xhr) ~> string`](#XHR-responseHeader) `XHR.responseHeader` returns a possibly observable property that emits the value of @@ -213,87 +213,87 @@ for specified `header` after the HTTP headers have been received. When called on a non-observable XHR, its [`readyState` must be 2](#XHR-headersReceived) or an `Error` will be thrown. -#### [≡](#contents) [`XHR.responseText(xhr) ~> string`](#XHR-responseText) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-responseText) [`XHR.responseText(xhr) ~> string`](#XHR-responseText) `XHR.responseText` returns a possibly observable property of the [`responseText`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseText) property of an ongoing XHR. -#### [≡](#contents) [`XHR.responseType(xhr) ~> string`](#XHR-responseType) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-responseType) [`XHR.responseType(xhr) ~> string`](#XHR-responseType) `XHR.responseType` returns a possibly observable property of the [`responseType`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType) of an ongoing XHR. -#### [≡](#contents) [`XHR.responseURL(xhr) ~> string`](#XHR-responseURL) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-responseURL) [`XHR.responseURL(xhr) ~> string`](#XHR-responseURL) `XHR.responseURL` returns a possibly observable property of the [`responseURL`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseURL) of an ongoing XHR. -#### [≡](#contents) [`XHR.responseXML(xhr) ~> document`](#XHR-responseXML) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-responseXML) [`XHR.responseXML(xhr) ~> document`](#XHR-responseXML) `XHR.responseXML` returns a possibly observable property of the [`responseXML`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseXML) property of an ongoing XHR. -#### [≡](#contents) [`XHR.status(xhr) ~> number`](#XHR-status) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-status) [`XHR.status(xhr) ~> number`](#XHR-status) `XHR.status` returns a possibly observable property of the [`status`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/status) of an ongoing XHR. -#### [≡](#contents) [`XHR.statusIsHttpSuccess(xhr) ~> boolean`](#XHR-statusIsHttpSuccess) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-statusIsHttpSuccess) [`XHR.statusIsHttpSuccess(xhr) ~> boolean`](#XHR-statusIsHttpSuccess) `XHR.statusIsHttpSuccess(xhr)` is shorthand for `XHR.isHttpSuccess(XHR.status(xhr))`. See also [`XHR.status`](#XHR-status) and [`XHR.isHttpSuccess`](#XHR-isHttpSuccess). -#### [≡](#contents) [`XHR.statusText(xhr) ~> string`](#XHR-statusText) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-statusText) [`XHR.statusText(xhr) ~> string`](#XHR-statusText) `XHR.statusText` returns a possibly observable property of the [`statusText`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/statusText) of an ongoing XHR. -#### [≡](#contents) [`XHR.timeout(xhr) ~> number`](#XHR-timeout) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-timeout) [`XHR.timeout(xhr) ~> number`](#XHR-timeout) `XHR.timeout` returns a possibly observable property of the [`timeout`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout) property of an ongoing XHR. -#### [≡](#contents) [`XHR.withCredentials(xhr) ~> boolean`](#XHR-withCredentials) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-withCredentials) [`XHR.withCredentials(xhr) ~> boolean`](#XHR-withCredentials) `XHR.withCredentials` returns a possibly observable property of the [`withCredentials`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials) property of an ongoing XHR. -### [≡](#contents) [Download state](#download-state) +### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#download-state) [Download state](#download-state) -#### [≡](#contents) [`XHR.downError(xhr) ~> exception`](#XHR-downError) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-downError) [`XHR.downError(xhr) ~> exception`](#XHR-downError) `XHR.downError` returns a possibly observable property of the [`error`](https://developer.mozilla.org/en-US/docs/Web/Events/error) property of a failed XHR. -#### [≡](#contents) [`XHR.downHasEnded(xhr) ~> boolean`](#XHR-downHasEnded) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-downHasEnded) [`XHR.downHasEnded(xhr) ~> boolean`](#XHR-downHasEnded) `XHR.downHasEnded` returns a possibly observable boolean property that tells whether the download operation of an ongoing XHR has [ended](https://developer.mozilla.org/en-US/docs/Web/Events/loadend). -#### [≡](#contents) [`XHR.downHasFailed(xhr) ~> boolean`](#XHR-downHasFailed) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-downHasFailed) [`XHR.downHasFailed(xhr) ~> boolean`](#XHR-downHasFailed) `XHR.downHasFailed` returns a possibly observable boolean property that tells whether the download operation of an ongoing XHR has [failed](https://developer.mozilla.org/en-US/docs/Web/Events/error). -#### [≡](#contents) [`XHR.downHasStarted(xhr) ~> boolean`](#XHR-downHasStarted) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-downHasStarted) [`XHR.downHasStarted(xhr) ~> boolean`](#XHR-downHasStarted) `XHR.downHasStarted` returns a possibly observable boolean property that tells whether the download operation of an ongoing XHR has [started](https://developer.mozilla.org/en-US/docs/Web/Events/loadstart). -#### [≡](#contents) [`XHR.downHasSucceeded(xhr) ~> boolean`](#XHR-downHasSucceeded) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-downHasSucceeded) [`XHR.downHasSucceeded(xhr) ~> boolean`](#XHR-downHasSucceeded) `XHR.downHasSucceeded` returns a possibly observable boolean property that tells whether the download operation of an ongoing XHR has @@ -301,57 +301,57 @@ whether the download operation of an ongoing XHR has that this does not take into account the HTTP response status, see [`XHR.status`](#XHR-status) and [`XHR.isHttpSuccess`](#XHR-isHttpSuccess). -#### [≡](#contents) [`XHR.downHasTimedOut(xhr) ~> boolean`](#XHR-downHasTimedOut) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-downHasTimedOut) [`XHR.downHasTimedOut(xhr) ~> boolean`](#XHR-downHasTimedOut) `XHR.downHasTimedOut` returns a possibly observable boolean property that tells whether the download operation of an ongoing XHR has [timed out](https://developer.mozilla.org/en-US/docs/Web/Events/timeout). -#### [≡](#contents) [`XHR.downIsProgressing(xhr) ~> boolean`](#XHR-downIsProgressing) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-downIsProgressing) [`XHR.downIsProgressing(xhr) ~> boolean`](#XHR-downIsProgressing) `XHR.downIsProgressing` returns a possibly observable boolean property that tells whether the download operation of an ongoing XHR is [progressing](https://developer.mozilla.org/en-US/docs/Web/Events/progress). -#### [≡](#contents) [`XHR.downLoaded(xhr) ~> number`](#XHR-downLoaded) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-downLoaded) [`XHR.downLoaded(xhr) ~> number`](#XHR-downLoaded) `XHR.downLoaded` returns a possibly observable property of the [`loaded`](https://developer.mozilla.org/en-US/docs/Web/Events/progress) property of an ongoing XHR. -#### [≡](#contents) [`XHR.downTotal(xhr) ~> number`](#XHR-downTotal) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-downTotal) [`XHR.downTotal(xhr) ~> number`](#XHR-downTotal) `XHR.downTotal` returns a possibly observable property of the [`total`](https://developer.mozilla.org/en-US/docs/Web/Events/progress) property of an ongoing XHR. -### [≡](#contents) [Upload state](#upload-state) +### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#upload-state) [Upload state](#upload-state) -#### [≡](#contents) [`XHR.upError(xhr) ~> exception`](#XHR-upError) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-upError) [`XHR.upError(xhr) ~> exception`](#XHR-upError) `XHR.upError` returns a possibly observable property of the [`error`](https://developer.mozilla.org/en-US/docs/Web/Events/error) property of a failed XHR. -#### [≡](#contents) [`XHR.upHasEnded(xhr) ~> boolean`](#XHR-upHasEnded) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-upHasEnded) [`XHR.upHasEnded(xhr) ~> boolean`](#XHR-upHasEnded) `XHR.upHasEnded` returns a possibly observable boolean property that tells whether the upload operation of an ongoing XHR has [ended](https://developer.mozilla.org/en-US/docs/Web/Events/loadend). -#### [≡](#contents) [`XHR.upHasFailed(xhr) ~> boolean`](#XHR-upHasFailed) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-upHasFailed) [`XHR.upHasFailed(xhr) ~> boolean`](#XHR-upHasFailed) `XHR.upHasFailed` returns a possibly observable boolean property that tells whether the upload operation of an ongoing XHR has [failed](https://developer.mozilla.org/en-US/docs/Web/Events/error). -#### [≡](#contents) [`XHR.upHasStarted(xhr) ~> boolean`](#XHR-upHasStarted) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-upHasStarted) [`XHR.upHasStarted(xhr) ~> boolean`](#XHR-upHasStarted) `XHR.upHasStarted` returns a possibly observable boolean property that tells whether the upload operation of an ongoing XHR has [started](https://developer.mozilla.org/en-US/docs/Web/Events/loadstart). -#### [≡](#contents) [`XHR.upHasSucceeded(xhr) ~> boolean`](#XHR-upHasSucceeded) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-upHasSucceeded) [`XHR.upHasSucceeded(xhr) ~> boolean`](#XHR-upHasSucceeded) `XHR.upHasSucceeded` returns a possibly observable boolean property that tells whether the upload operation of an ongoing XHR has @@ -359,33 +359,33 @@ whether the upload operation of an ongoing XHR has that this does not take into account the HTTP response status, see [`XHR.status`](#XHR-status) and [`XHR.isHttpSuccess`](#XHR-isHttpSuccess). -#### [≡](#contents) [`XHR.upHasTimedOut(xhr) ~> boolean`](#XHR-upHasTimedOut) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-upHasTimedOut) [`XHR.upHasTimedOut(xhr) ~> boolean`](#XHR-upHasTimedOut) `XHR.upHasTimedOut` returns a possibly observable boolean property that tells whether the upload operation of an ongoing XHR has [timed out](https://developer.mozilla.org/en-US/docs/Web/Events/timeout). -#### [≡](#contents) [`XHR.upIsProgressing(xhr) ~> boolean`](#XHR-upIsProgressing) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-upIsProgressing) [`XHR.upIsProgressing(xhr) ~> boolean`](#XHR-upIsProgressing) `XHR.upIsProgressing` returns a possibly observable boolean property that tells whether the upload operation of an ongoing XHR is [progressing](https://developer.mozilla.org/en-US/docs/Web/Events/progress). -#### [≡](#contents) [`XHR.upLoaded(xhr) ~> number`](#XHR-upLoaded) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-upLoaded) [`XHR.upLoaded(xhr) ~> number`](#XHR-upLoaded) `XHR.upLoaded` returns a possibly observable property of the [`loaded`](https://developer.mozilla.org/en-US/docs/Web/Events/progress) property of an ongoing XHR. -#### [≡](#contents) [`XHR.upTotal(xhr) ~> number`](#XHR-upTotal) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-upTotal) [`XHR.upTotal(xhr) ~> number`](#XHR-upTotal) `XHR.upTotal` returns a possibly observable property of the [`total`](https://developer.mozilla.org/en-US/docs/Web/Events/progress) property of an ongoing XHR. -### [≡](#contents) [Auxiliary](#auxiliary) +### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#auxiliary) [Auxiliary](#auxiliary) -#### [≡](#contents) [`XHR.isHttpSuccess(number) ~> boolean`](#XHR-isHttpSuccess) +#### [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#XHR-isHttpSuccess) [`XHR.isHttpSuccess(number) ~> boolean`](#XHR-isHttpSuccess) `XHR.isHttpSuccess` returns a possibly observable property of whether the given numeric property is in the range 2xx of [HTTP success diff --git a/dist/karet.xhr.js b/dist/karet.xhr.js index 5b51dee..d219deb 100644 --- a/dist/karet.xhr.js +++ b/dist/karet.xhr.js @@ -1,7 +1,7 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('karet.lift'), require('infestines'), require('kefir'), require('kefir.partial.lenses'), require('partial.lenses.validation')) : typeof define === 'function' && define.amd ? define(['exports', 'karet.lift', 'infestines', 'kefir', 'kefir.partial.lenses', 'partial.lenses.validation'], factory) : - (factory((global.karet = global.karet || {}, global.karet.xhr = {}),global.karet.lift,global.I,global.Kefir,global.kefir.partial.lenses,global.V)); + (factory((global.karet = global.karet || {}, global.karet.xhr = {}),global.karet.lift,global.I,global.Kefir,global.Kefir.partial.lenses,global.V)); }(this, (function (exports,F,I,K,L,V) { 'use strict'; // diff --git a/dist/karet.xhr.min.js b/dist/karet.xhr.min.js index df62dcd..8bc340e 100644 --- a/dist/karet.xhr.min.js +++ b/dist/karet.xhr.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("karet.lift"),require("infestines"),require("kefir"),require("kefir.partial.lenses")):"function"==typeof define&&define.amd?define(["exports","karet.lift","infestines","kefir","kefir.partial.lenses","partial.lenses.validation"],t):t((e.karet=e.karet||{},e.karet.xhr={}),e.karet.lift,e.I,e.Kefir,e.kefir.partial.lenses)}(this,function(e,r,v,o,h,t){"use strict";function n(e){var t=r.combine([e],f);return(s(t)?t.flatMapLatest(p):p(t)).toProperty()}var s=function(e){return e instanceof o.Observable},i=v.curry(function(e,t){return s(t)?t.skipDuplicates(e):t}),u=v.curry(function(e,t){if(s(t))return t.filter(e);if(e(t))return t;throw Error(e.name)}),a=function(e){return e},w={type:"initial"},H=["loadstart","progress","timeout","load","error"],d="xhr",T="up",k="down",E="event",p=(0,v.id)(function(e){var u=e.url,t=e.method,a=void 0===t?"GET":t,r=e.user,d=void 0===r?null:r,n=e.password,p=void 0===n?null:n,f=e.headers,c=e.overrideMimeType,s=e.body,l=void 0===s?null:s,y=e.responseType,g=e.timeout,m=e.withCredentials;return o.stream(function(e){var n=e.emit,t=e.end,r=new XMLHttpRequest,s={xhr:r,up:w,down:w},o=function(t,r){return function(e){n(s=h.set(t,{type:r,event:e},s))}};if(H.forEach(function(e){r.addEventListener(e,o(k,e)),r.upload.addEventListener(e,o(T,e))}),r.addEventListener("readystatechange",function(e){n(s=h.set(E,e,s))}),r.addEventListener("loadend",function(e){t(n(s=h.set(E,e,s)))}),r.open(a,u,!0,d,p),y&&"json"===(r.responseType=y)&&"json"!==r.responseType&&(s=h.set("parse",!0,s)),g&&(r.timeout=g),m&&(r.withCredentials=m),null!=f)if(v.isFunction(f.keys)&&(f=Array.from(f)),v.isArray(f))f.forEach(function(e){r.setRequestHeader(e[0],e[1])});else for(var i in f)r.setRequestHeader(i,f[i]);return c&&r.overrideMimeType(c),r.send(l),function(){r.status||r.abort()}})}),f=function(e){return v.isString(e)?{url:e}:e},c=v.curry(function(e,t){return e.includes(t)}),l=v.curry(function(e,t){return h.get([t,"type",c(e)])}),y=l(H),g=l(["progress","loadstart"]),m=l(["load"]),x=l(["error"]),L=l(["timeout"]),S=l(["load","error","timeout"]),R=v.curry(function(e,t){return h.get([t,E,e])}),q=R("loaded"),U=R("total"),b=R("error"),M=function(e){return 200<=e&&e<300},j=v.curryN(3,function(e,t){return v.pipe2U(u(e),t)}),N=a(y(T)),O=a(g(T)),C=a(m(T)),F=a(x(T)),I=a(L(T)),P=a(S(T)),A=a(q(T)),D=a(U(T)),J=a(b(T)),X=a(y(k)),_=a(g(k)),G=a(m(k)),K=a(x(k)),W=a(L(k)),z=a(S(k)),B=a(q(k)),Q=a(U(k)),V=a(b(k)),Y=a(h.get([d,"readyState"])),Z=v.defineNameU(h.get([d,"readyState",function(e){return 2<=e}]),"headersReceived"),$=v.defineNameU(h.get([E,"type",h.is("loadend")]),"isDone"),ee=a(v.pipe2U(r.lift(function(e){var t=e.xhr.response;return e.parse?function(e){try{return JSON.parse(e)}catch(e){return null}}(t):t}),i(v.acyclicEqualsU))),te=a(j($,ee)),re=a(h.get([d,"responseType"])),ne=a(h.get([d,"responseURL"])),se=a(h.get([d,h.when(h.get(["responseType",c(["","text"])])),"responseText"])),oe=j($,a(h.get([d,h.when(h.get(["responseType",c(["","document"])])),"responseXML"]))),ie=a(h.get([d,"status"])),ue=a(h.get([d,"status",M])),ae=a(h.get([d,"statusText"])),de=v.curryN(2,function(t){return j(Z,a(h.get([d,h.reread(function(e){return e.getResponseHeader(t)})])))}),pe=j(Z,a(h.get([d,h.reread(function(e){return e.getAllResponseHeaders()})]))),fe=a(h.get([d,"timeout"])),ce=a(h.get([d,"withCredentials"])),le=r.lift(M),ye=r.lift(function(e,t){return v.assign({},f(e),f(t))}),ge=v.curry(function(e,t){return n(ye(e,t))}),me=a(ge({responseType:"json"})),ve=a(v.pipe2U(me,te));e.perform=n,e.upHasStarted=N,e.upIsProgressing=O,e.upHasSucceeded=C,e.upHasFailed=F,e.upHasTimedOut=I,e.upHasEnded=P,e.upLoaded=A,e.upTotal=D,e.upError=J,e.downHasStarted=X,e.downIsProgressing=_,e.downHasSucceeded=G,e.downHasFailed=K,e.downHasTimedOut=W,e.downHasEnded=z,e.downLoaded=B,e.downTotal=Q,e.downError=V,e.readyState=Y,e.headersReceived=Z,e.isDone=$,e.response=ee,e.responseFull=te,e.responseType=re,e.responseURL=ne,e.responseText=se,e.responseXML=oe,e.status=ie,e.statusIsHttpSuccess=ue,e.statusText=ae,e.responseHeader=de,e.allResponseHeaders=pe,e.timeout=fe,e.withCredentials=ce,e.isHttpSuccess=le,e.performWith=ge,e.performJson=me,e.getJson=ve,Object.defineProperty(e,"__esModule",{value:!0})}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("karet.lift"),require("infestines"),require("kefir"),require("kefir.partial.lenses")):"function"==typeof define&&define.amd?define(["exports","karet.lift","infestines","kefir","kefir.partial.lenses","partial.lenses.validation"],t):t((e.karet=e.karet||{},e.karet.xhr={}),e.karet.lift,e.I,e.Kefir,e.Kefir.partial.lenses)}(this,function(e,r,v,o,h,t){"use strict";function n(e){var t=r.combine([e],f);return(s(t)?t.flatMapLatest(p):p(t)).toProperty()}var s=function(e){return e instanceof o.Observable},i=v.curry(function(e,t){return s(t)?t.skipDuplicates(e):t}),u=v.curry(function(e,t){if(s(t))return t.filter(e);if(e(t))return t;throw Error(e.name)}),a=function(e){return e},w={type:"initial"},H=["loadstart","progress","timeout","load","error"],d="xhr",T="up",E="down",k="event",p=(0,v.id)(function(e){var u=e.url,t=e.method,a=void 0===t?"GET":t,r=e.user,d=void 0===r?null:r,n=e.password,p=void 0===n?null:n,f=e.headers,c=e.overrideMimeType,s=e.body,l=void 0===s?null:s,y=e.responseType,g=e.timeout,m=e.withCredentials;return o.stream(function(e){var n=e.emit,t=e.end,r=new XMLHttpRequest,s={xhr:r,up:w,down:w},o=function(t,r){return function(e){n(s=h.set(t,{type:r,event:e},s))}};if(H.forEach(function(e){r.addEventListener(e,o(E,e)),r.upload.addEventListener(e,o(T,e))}),r.addEventListener("readystatechange",function(e){n(s=h.set(k,e,s))}),r.addEventListener("loadend",function(e){t(n(s=h.set(k,e,s)))}),r.open(a,u,!0,d,p),y&&"json"===(r.responseType=y)&&"json"!==r.responseType&&(s=h.set("parse",!0,s)),g&&(r.timeout=g),m&&(r.withCredentials=m),null!=f)if(v.isFunction(f.keys)&&(f=Array.from(f)),v.isArray(f))f.forEach(function(e){r.setRequestHeader(e[0],e[1])});else for(var i in f)r.setRequestHeader(i,f[i]);return c&&r.overrideMimeType(c),r.send(l),function(){r.status||r.abort()}})}),f=function(e){return v.isString(e)?{url:e}:e},c=v.curry(function(e,t){return e.includes(t)}),l=v.curry(function(e,t){return h.get([t,"type",c(e)])}),y=l(H),g=l(["progress","loadstart"]),m=l(["load"]),x=l(["error"]),L=l(["timeout"]),S=l(["load","error","timeout"]),R=v.curry(function(e,t){return h.get([t,k,e])}),q=R("loaded"),U=R("total"),b=R("error"),M=function(e){return 200<=e&&e<300},j=v.curryN(3,function(e,t){return v.pipe2U(u(e),t)}),N=a(y(T)),O=a(g(T)),C=a(m(T)),F=a(x(T)),I=a(L(T)),P=a(S(T)),A=a(q(T)),D=a(U(T)),J=a(b(T)),X=a(y(E)),K=a(g(E)),_=a(m(E)),G=a(x(E)),W=a(L(E)),z=a(S(E)),B=a(q(E)),Q=a(U(E)),V=a(b(E)),Y=a(h.get([d,"readyState"])),Z=v.defineNameU(h.get([d,"readyState",function(e){return 2<=e}]),"headersReceived"),$=v.defineNameU(h.get([k,"type",h.is("loadend")]),"isDone"),ee=a(v.pipe2U(r.lift(function(e){var t=e.xhr.response;return e.parse?function(e){try{return JSON.parse(e)}catch(e){return null}}(t):t}),i(v.acyclicEqualsU))),te=a(j($,ee)),re=a(h.get([d,"responseType"])),ne=a(h.get([d,"responseURL"])),se=a(h.get([d,h.when(h.get(["responseType",c(["","text"])])),"responseText"])),oe=j($,a(h.get([d,h.when(h.get(["responseType",c(["","document"])])),"responseXML"]))),ie=a(h.get([d,"status"])),ue=a(h.get([d,"status",M])),ae=a(h.get([d,"statusText"])),de=v.curryN(2,function(t){return j(Z,a(h.get([d,h.reread(function(e){return e.getResponseHeader(t)})])))}),pe=j(Z,a(h.get([d,h.reread(function(e){return e.getAllResponseHeaders()})]))),fe=a(h.get([d,"timeout"])),ce=a(h.get([d,"withCredentials"])),le=r.lift(M),ye=r.lift(function(e,t){return v.assign({},f(e),f(t))}),ge=v.curry(function(e,t){return n(ye(e,t))}),me=a(ge({responseType:"json"})),ve=a(v.pipe2U(me,te));e.perform=n,e.upHasStarted=N,e.upIsProgressing=O,e.upHasSucceeded=C,e.upHasFailed=F,e.upHasTimedOut=I,e.upHasEnded=P,e.upLoaded=A,e.upTotal=D,e.upError=J,e.downHasStarted=X,e.downIsProgressing=K,e.downHasSucceeded=_,e.downHasFailed=G,e.downHasTimedOut=W,e.downHasEnded=z,e.downLoaded=B,e.downTotal=Q,e.downError=V,e.readyState=Y,e.headersReceived=Z,e.isDone=$,e.response=ee,e.responseFull=te,e.responseType=re,e.responseURL=ne,e.responseText=se,e.responseXML=oe,e.status=ie,e.statusIsHttpSuccess=ue,e.statusText=ae,e.responseHeader=de,e.allResponseHeaders=pe,e.timeout=fe,e.withCredentials=ce,e.isHttpSuccess=le,e.performWith=ge,e.performJson=me,e.getJson=ve,Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/docs/fw/clicks-to-ga.js b/docs/fw/clicks-to-ga.js new file mode 100644 index 0000000..0892b56 --- /dev/null +++ b/docs/fw/clicks-to-ga.js @@ -0,0 +1,16 @@ +;(function() { + 'use strict' + + function clicksToGA() { + function onclick(e) { + ga('send', 'event', 'link', 'click', e.target.href) + } + Array.prototype.slice + .call(document.querySelectorAll('a')) + .forEach(function(elem) { + elem.onclick = onclick + }) + } + + window.addEventListener('load', clicksToGA) +})() diff --git a/docs/fw/github.css b/docs/fw/github.css new file mode 100644 index 0000000..e197e59 --- /dev/null +++ b/docs/fw/github.css @@ -0,0 +1,709 @@ +@font-face { + font-family: octicons-link; + src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAAizAFoAAABiAGIAznjaY2BkYGAA4in8zwXi+W2+MjCzMIDApSwvXzC97Z4Ig8N/BxYGZgcgl52BCSQKAA3jCV8CAABfAAAAAAQAAEB42mNgZGBg4f3vACQZQABIMjKgAmYAKEgBXgAAeNpjYGY6wTiBgZWBg2kmUxoDA4MPhGZMYzBi1AHygVLYQUCaawqDA4PChxhmh/8ODDEsvAwHgMKMIDnGL0x7gJQCAwMAJd4MFwAAAHjaY2BgYGaA4DAGRgYQkAHyGMF8NgYrIM3JIAGVYYDT+AEjAwuDFpBmA9KMDEwMCh9i/v8H8sH0/4dQc1iAmAkALaUKLgAAAHjaTY9LDsIgEIbtgqHUPpDi3gPoBVyRTmTddOmqTXThEXqrob2gQ1FjwpDvfwCBdmdXC5AVKFu3e5MfNFJ29KTQT48Ob9/lqYwOGZxeUelN2U2R6+cArgtCJpauW7UQBqnFkUsjAY/kOU1cP+DAgvxwn1chZDwUbd6CFimGXwzwF6tPbFIcjEl+vvmM/byA48e6tWrKArm4ZJlCbdsrxksL1AwWn/yBSJKpYbq8AXaaTb8AAHja28jAwOC00ZrBeQNDQOWO//sdBBgYGRiYWYAEELEwMTE4uzo5Zzo5b2BxdnFOcALxNjA6b2ByTswC8jYwg0VlNuoCTWAMqNzMzsoK1rEhNqByEyerg5PMJlYuVueETKcd/89uBpnpvIEVomeHLoMsAAe1Id4AAAAAAAB42oWQT07CQBTGv0JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==) format('woff'); +} + +.markdown-body { + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + line-height: 1.5; + color: #24292e; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + font-size: 16px; + line-height: 1.5; + word-wrap: break-word; +} + +.markdown-body .pl-c { + color: #6a737d; +} + +.markdown-body .pl-c1, +.markdown-body .pl-s .pl-v { + color: #005cc5; +} + +.markdown-body .pl-e, +.markdown-body .pl-en { + color: #6f42c1; +} + +.markdown-body .pl-smi, +.markdown-body .pl-s .pl-s1 { + color: #24292e; +} + +.markdown-body .pl-ent { + color: #22863a; +} + +.markdown-body .pl-k { + color: #d73a49; +} + +.markdown-body .pl-s, +.markdown-body .pl-pds, +.markdown-body .pl-s .pl-pse .pl-s1, +.markdown-body .pl-sr, +.markdown-body .pl-sr .pl-cce, +.markdown-body .pl-sr .pl-sre, +.markdown-body .pl-sr .pl-sra { + color: #032f62; +} + +.markdown-body .pl-v, +.markdown-body .pl-smw { + color: #e36209; +} + +.markdown-body .pl-bu { + color: #b31d28; +} + +.markdown-body .pl-ii { + color: #fafbfc; + background-color: #b31d28; +} + +.markdown-body .pl-c2 { + color: #fafbfc; + background-color: #d73a49; +} + +.markdown-body .pl-c2::before { + content: "^M"; +} + +.markdown-body .pl-sr .pl-cce { + font-weight: bold; + color: #22863a; +} + +.markdown-body .pl-ml { + color: #735c0f; +} + +.markdown-body .pl-mh, +.markdown-body .pl-mh .pl-en, +.markdown-body .pl-ms { + font-weight: bold; + color: #005cc5; +} + +.markdown-body .pl-mi { + font-style: italic; + color: #24292e; +} + +.markdown-body .pl-mb { + font-weight: bold; + color: #24292e; +} + +.markdown-body .pl-md { + color: #b31d28; + background-color: #ffeef0; +} + +.markdown-body .pl-mi1 { + color: #22863a; + background-color: #f0fff4; +} + +.markdown-body .pl-mc { + color: #e36209; + background-color: #ffebda; +} + +.markdown-body .pl-mi2 { + color: #f6f8fa; + background-color: #005cc5; +} + +.markdown-body .pl-mdr { + font-weight: bold; + color: #6f42c1; +} + +.markdown-body .pl-ba { + color: #586069; +} + +.markdown-body .pl-sg { + color: #959da5; +} + +.markdown-body .pl-corl { + text-decoration: underline; + color: #032f62; +} + +.markdown-body .octicon { + display: inline-block; + vertical-align: text-top; + fill: currentColor; +} + +.markdown-body a { + background-color: transparent; + -webkit-text-decoration-skip: objects; +} + +.markdown-body a:active, +.markdown-body a:hover { + outline-width: 0; +} + +.markdown-body strong { + font-weight: inherit; +} + +.markdown-body strong { + font-weight: bolder; +} + +.markdown-body h1 { + font-size: 2em; + margin: 0.67em 0; +} + +.markdown-body img { + border-style: none; +} + +.markdown-body svg:not(:root) { + overflow: hidden; +} + +.markdown-body code, +.markdown-body kbd, +.markdown-body pre { + font-family: monospace, monospace; + font-size: 1em; +} + +.markdown-body hr { + box-sizing: content-box; + height: 0; + overflow: visible; +} + +.markdown-body input { + font: inherit; + margin: 0; +} + +.markdown-body input { + overflow: visible; +} + +.markdown-body [type="checkbox"] { + box-sizing: border-box; + padding: 0; +} + +.markdown-body * { + box-sizing: border-box; +} + +.markdown-body input { + font-family: inherit; + font-size: inherit; + line-height: inherit; +} + +.markdown-body a { + color: #0366d6; + text-decoration: none; +} + +.markdown-body a:hover { + text-decoration: underline; +} + +.markdown-body strong { + font-weight: 600; +} + +.markdown-body hr { + height: 0; + margin: 15px 0; + overflow: hidden; + background: transparent; + border: 0; + border-bottom: 1px solid #dfe2e5; +} + +.markdown-body hr::before { + display: table; + content: ""; +} + +.markdown-body hr::after { + display: table; + clear: both; + content: ""; +} + +.markdown-body table { + border-spacing: 0; + border-collapse: collapse; +} + +.markdown-body td, +.markdown-body th { + padding: 0; +} + +.markdown-body h1, +.markdown-body h2, +.markdown-body h3, +.markdown-body h4, +.markdown-body h5, +.markdown-body h6 { + margin-top: 0; + margin-bottom: 0; +} + +.markdown-body h1 { + font-size: 32px; + font-weight: 600; +} + +.markdown-body h2 { + font-size: 24px; + font-weight: 600; +} + +.markdown-body h3 { + font-size: 20px; + font-weight: 600; +} + +.markdown-body h4 { + font-size: 16px; + font-weight: 600; +} + +.markdown-body h5 { + font-size: 14px; + font-weight: 600; +} + +.markdown-body h6 { + font-size: 12px; + font-weight: 600; +} + +.markdown-body p { + margin-top: 0; + margin-bottom: 10px; +} + +.markdown-body blockquote { + margin: 0; +} + +.markdown-body ul, +.markdown-body ol { + padding-left: 0; + margin-top: 0; + margin-bottom: 0; +} + +.markdown-body ol ol, +.markdown-body ul ol { + list-style-type: lower-roman; +} + +.markdown-body ul ul ol, +.markdown-body ul ol ol, +.markdown-body ol ul ol, +.markdown-body ol ol ol { + list-style-type: lower-alpha; +} + +.markdown-body dd { + margin-left: 0; +} + +.markdown-body code { + font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 12px; +} + +.markdown-body pre { + margin-top: 0; + margin-bottom: 0; + font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 12px; +} + +.markdown-body .octicon { + vertical-align: text-bottom; +} + +.markdown-body .pl-0 { + padding-left: 0 !important; +} + +.markdown-body .pl-1 { + padding-left: 4px !important; +} + +.markdown-body .pl-2 { + padding-left: 8px !important; +} + +.markdown-body .pl-3 { + padding-left: 16px !important; +} + +.markdown-body .pl-4 { + padding-left: 24px !important; +} + +.markdown-body .pl-5 { + padding-left: 32px !important; +} + +.markdown-body .pl-6 { + padding-left: 40px !important; +} + +.markdown-body::before { + display: table; + content: ""; +} + +.markdown-body::after { + display: table; + clear: both; + content: ""; +} + +.markdown-body>*:first-child { + margin-top: 0 !important; +} + +.markdown-body>*:last-child { + margin-bottom: 0 !important; +} + +.markdown-body a:not([href]) { + color: inherit; + text-decoration: none; +} + +.markdown-body .anchor { + float: left; + padding-right: 4px; + margin-left: -20px; + line-height: 1; +} + +.markdown-body .anchor:focus { + outline: none; +} + +.markdown-body p, +.markdown-body blockquote, +.markdown-body ul, +.markdown-body ol, +.markdown-body dl, +.markdown-body table, +.markdown-body pre { + margin-top: 0; + margin-bottom: 16px; +} + +.markdown-body hr { + height: 0.25em; + padding: 0; + margin: 24px 0; + background-color: #e1e4e8; + border: 0; +} + +.markdown-body blockquote { + padding: 0 1em; + color: #6a737d; + border-left: 0.25em solid #dfe2e5; +} + +.markdown-body blockquote>:first-child { + margin-top: 0; +} + +.markdown-body blockquote>:last-child { + margin-bottom: 0; +} + +.markdown-body kbd { + display: inline-block; + padding: 3px 5px; + font-size: 11px; + line-height: 10px; + color: #444d56; + vertical-align: middle; + background-color: #fafbfc; + border: solid 1px #c6cbd1; + border-bottom-color: #959da5; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #959da5; +} + +.markdown-body h1, +.markdown-body h2, +.markdown-body h3, +.markdown-body h4, +.markdown-body h5, +.markdown-body h6 { + margin-top: 24px; + margin-bottom: 16px; + font-weight: 600; + line-height: 1.25; +} + +.markdown-body h1 .octicon-link, +.markdown-body h2 .octicon-link, +.markdown-body h3 .octicon-link, +.markdown-body h4 .octicon-link, +.markdown-body h5 .octicon-link, +.markdown-body h6 .octicon-link { + color: #1b1f23; + vertical-align: middle; + visibility: hidden; +} + +.markdown-body h1:hover .anchor, +.markdown-body h2:hover .anchor, +.markdown-body h3:hover .anchor, +.markdown-body h4:hover .anchor, +.markdown-body h5:hover .anchor, +.markdown-body h6:hover .anchor { + text-decoration: none; +} + +.markdown-body h1:hover .anchor .octicon-link, +.markdown-body h2:hover .anchor .octicon-link, +.markdown-body h3:hover .anchor .octicon-link, +.markdown-body h4:hover .anchor .octicon-link, +.markdown-body h5:hover .anchor .octicon-link, +.markdown-body h6:hover .anchor .octicon-link { + visibility: visible; +} + +.markdown-body h1 { + padding-bottom: 0.3em; + font-size: 2em; + border-bottom: 1px solid #eaecef; +} + +.markdown-body h2 { + padding-bottom: 0.3em; + font-size: 1.5em; + border-bottom: 1px solid #eaecef; +} + +.markdown-body h3 { + font-size: 1.25em; +} + +.markdown-body h4 { + font-size: 1em; +} + +.markdown-body h5 { + font-size: 0.875em; +} + +.markdown-body h6 { + font-size: 0.85em; + color: #6a737d; +} + +.markdown-body ul, +.markdown-body ol { + padding-left: 2em; +} + +.markdown-body ul ul, +.markdown-body ul ol, +.markdown-body ol ol, +.markdown-body ol ul { + margin-top: 0; + margin-bottom: 0; +} + +.markdown-body li>p { + margin-top: 16px; +} + +.markdown-body li+li { + margin-top: 0.25em; +} + +.markdown-body dl { + padding: 0; +} + +.markdown-body dl dt { + padding: 0; + margin-top: 16px; + font-size: 1em; + font-style: italic; + font-weight: 600; +} + +.markdown-body dl dd { + padding: 0 16px; + margin-bottom: 16px; +} + +.markdown-body table { + display: block; + width: 100%; + overflow: auto; +} + +.markdown-body table th { + font-weight: 600; +} + +.markdown-body table th, +.markdown-body table td { + padding: 6px 13px; + border: 1px solid #dfe2e5; +} + +.markdown-body table tr { + background-color: #fff; + border-top: 1px solid #c6cbd1; +} + +.markdown-body table tr:nth-child(2n) { + background-color: #f6f8fa; +} + +.markdown-body img { + max-width: 100%; + box-sizing: content-box; + background-color: #fff; +} + +.markdown-body img[align=right] { + padding-left: 20px; +} + +.markdown-body img[align=left] { + padding-right: 20px; +} + +.markdown-body code { + padding: 0; + padding-top: 0.2em; + padding-bottom: 0.2em; + margin: 0; + font-size: 85%; + background-color: rgba(27,31,35,0.05); + border-radius: 3px; +} + +.markdown-body code::before, +.markdown-body code::after { + letter-spacing: -0.2em; + content: "\00a0"; +} + +.markdown-body pre { + word-wrap: normal; +} + +.markdown-body pre>code { + padding: 0; + margin: 0; + font-size: 100%; + word-break: normal; + white-space: pre; + background: transparent; + border: 0; +} + +.markdown-body .highlight { + margin-bottom: 16px; +} + +.markdown-body .highlight pre { + margin-bottom: 0; + word-break: normal; +} + +.markdown-body .highlight pre, +.markdown-body pre { + padding: 16px; + overflow: auto; + font-size: 85%; + line-height: 1.45; + background-color: #f6f8fa; + border-radius: 3px; +} + +.markdown-body pre code { + display: inline; + max-width: auto; + padding: 0; + margin: 0; + overflow: visible; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; +} + +.markdown-body pre code::before, +.markdown-body pre code::after { + content: normal; +} + +.markdown-body .full-commit .btn-outline:not(:disabled):hover { + color: #005cc5; + border-color: #005cc5; +} + +.markdown-body kbd { + display: inline-block; + padding: 3px 5px; + font: 11px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; + line-height: 10px; + color: #444d56; + vertical-align: middle; + background-color: #fafbfc; + border: solid 1px #d1d5da; + border-bottom-color: #c6cbd1; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #c6cbd1; +} + +.markdown-body :checked+.radio-label { + position: relative; + z-index: 1; + border-color: #0366d6; +} + +.markdown-body .task-list-item { + list-style-type: none; +} + +.markdown-body .task-list-item+.task-list-item { + margin-top: 3px; +} + +.markdown-body .task-list-item input { + margin: 0 0.2em 0.25em -1.6em; + vertical-align: middle; +} + +.markdown-body hr { + border-bottom-color: #eee; +} diff --git a/docs/fw/init-hljs.js b/docs/fw/init-hljs.js new file mode 100644 index 0000000..70fdd95 --- /dev/null +++ b/docs/fw/init-hljs.js @@ -0,0 +1,7 @@ +'use strict' + +Array.prototype.slice + .call(document.querySelectorAll('.hljs')) + .forEach(function(elem) { + window.hljs.highlightBlock(elem) + }) diff --git a/docs/fw/klipse-settings.js b/docs/fw/klipse-settings.js new file mode 100644 index 0000000..ef215dd --- /dev/null +++ b/docs/fw/klipse-settings.js @@ -0,0 +1,149 @@ +'use strict' + +function acyclicEquals(l, r) { + if (Object.is(l, r)) return true + if ( + !l || + !r || + typeof l !== 'object' || + typeof r !== 'object' || + Object.getPrototypeOf(l) !== Object.getPrototypeOf(r) + ) + return false + const kl = Object.keys(l).sort() + const kr = Object.keys(r).sort() + if (kl.length !== kr.length) return false + for (let i = 0; i < kl.length; ++i) if (kl[i] !== kr[i]) return false + if (void 0 !== kl.find(k => !acyclicEquals(l[k], r[k]))) return false + return true +} + +function test(name, actual, expect) { + if (acyclicEquals(actual, expect)) console.log(name, 'Ok') + else console.log(name, 'Error', actual) +} + +function log() { + console.log.apply(null, arguments) +} + +window.klipse_settings = window.klipse_settings || { + codemirror_options_in: window.codemirror_options_in || { + lineWrapping: false, + autoCloseBrackets: false, + cursorBlinkRate: 0 + }, + codemirror_options_out: window.codemirror_options_out || { + lineWrapping: true + }, + eval_idle_msec: 150, + selector_eval_js: '.lang-js' +} + +function accelerate_klipse() { + const all = Array.prototype.slice.call( + document.querySelectorAll('.CodeMirror'), + 0, + -1 + ) + + function hide(i) { + const e = all[i] + e.parentNode.style.cssText = + 'min-height: ' + e.getBoundingClientRect().height + 'px;' + e.style.cssText = '' + } + function show(i) { + const e = all[i] + e.parentNode.style.cssText = '' + e.style.cssText = 'display: block;' + e.CodeMirror.refresh() + } + function hasBeenShown(i) { + const e = all[i] + return e.style.length + } + + let oldVisStart = 0 + let oldVisStop = 0 + + function visibility(i, height) { + const e = all[i] + const r = e.parentNode.getBoundingClientRect() + return height <= r.top ? 1 : r.bottom < 0 ? -1 : 0 + } + + function findFirst(i, height) { + while (0 < i && 0 === visibility(i - 1, height)) --i + return i + } + + function findBinary(begin, count, height) { + const middle = begin + (count >> 1) + if (count <= 0) return null + switch (visibility(middle, height)) { + case 1: + return findBinary(begin, count >> 1, height) + case 0: + return findFirst(middle, height) + default: + return findBinary(middle + 1, count - 1 - (count >> 1), height) + } + } + + function findVisible(height) { + const guess = (oldVisStart + oldVisStop) >> 1 + if (0 === visibility(guess, height)) return findFirst(guess, height) + else return findBinary(0, all.length, height) + } + + function getPos() { + return { + offset: window.pageYOffset, + width: window.innerWidth, + height: window.innerHeight + } + } + + let updatedAt = undefined + let scheduled = 0 + + function update() { + if (0 < scheduled) --scheduled + + updatedAt = getPos() + + let vis = findVisible(updatedAt.height) + if (null === vis) return + + const newVisStart = vis + + do { + if (vis < oldVisStart || oldVisStop <= vis) show(vis) + ++vis + } while (vis < all.length && 0 === visibility(vis, updatedAt.height)) + + const newVisStop = vis + + for (let i = oldVisStart; i < oldVisStop; ++i) + if (i < newVisStart || newVisStop <= i) hide(i) + + oldVisStart = newVisStart + oldVisStop = newVisStop + } + + function scheduleUpdate() { + if (0 < scheduled || acyclicEquals(updatedAt, getPos())) return + scheduled = 2 + setTimeout(() => { + if (0 < scheduled) --scheduled + if (!scheduled) scheduleUpdate() + }, 300) + window.requestAnimationFrame(update) + } + + scheduleUpdate() + + window.addEventListener('scroll', scheduleUpdate) + window.addEventListener('resize', scheduleUpdate) +} diff --git a/docs/fw/menu.js b/docs/fw/menu.js new file mode 100644 index 0000000..5ded937 --- /dev/null +++ b/docs/fw/menu.js @@ -0,0 +1,37 @@ +;(function() { + 'use strict' + + function removeIds(elem) { + elem.removeAttribute('id') + for (var i = 0, n = elem.childElementCount; i < n; ++i) + removeIds(elem.children[i]) + return elem + } + + function createMenu() { + var menu = document.querySelector('.menu') + if (!menu) return + var menuContents = menu.querySelector('.menu-contents') + if (!menuContents) return + var contents = document.querySelector('#contents') + while ( + contents && + contents.nextElementSibling && + contents.nextElementSibling.tagName !== 'UL' + ) + contents = contents.parentNode + if (!contents) return + var tree = contents.nextElementSibling + if (!tree) return + menu.onclick = function(e) { + menu.className = + menu.className === 'menu' && e.target.tagName === 'DIV' + ? 'menu open' + : 'menu' + e.stopPropagation() + } + menuContents.appendChild(removeIds(tree.cloneNode(true))) + } + + window.addEventListener('load', createMenu) +})() diff --git a/docs/fw/styles.css b/docs/fw/styles.css new file mode 100644 index 0000000..8de1f83 --- /dev/null +++ b/docs/fw/styles.css @@ -0,0 +1,208 @@ +.hint { + position: relative; + display: inline-block; + padding: 1px; +} +.hint::after { + content: ' '; + position: absolute; + align-items: center; + overflow: hidden; + top: 0%; + left: 0%; + width: 100%; + height: 100%; + background: white; + border-radius: 3px; + border: 1px solid rgba(0, 0, 0, 255); +} +.hint:hover::after { + display: none; +} + +.markdown-body h4 code { + font-size: 16px; +} +.markdown-body h5 code { + font-size: 14px; +} + +.markdown-body { + box-sizing: border-box; + min-width: 200px; + max-width: 980px; + margin: 45px auto; + padding: 45px; + border: 1px #ddd solid; + border-radius: 3px; +} + +.markdown-body > pre { + padding: 11px; +} + +.CodeMirror { + display: none; + border: none; + font: 13.6px Consolas, 'Liberation Mono', Menlo, Courier, monospace; + line-height: 19.72px; +} + +.CodeMirror-linenumber:hover { + color: #777; +} + +#playground .CodeMirror { + display: block; +} + +.klipse-snippet .CodeMirror { + border: 1px #f7f7f7 solid; + border-radius: 5px; +} + +.markdown-body > pre > code { + display: block; + padding: 5px; +} + +.klipse-snippet .CodeMirror:hover { + border: 1px #ddd solid; +} + +.klipse-result .CodeMirror { + background: #f7f7f7; +} + +.klipse-result .CodeMirror { + background: transparent; + filter: brightness(50%); + opacity: 0.85; +} + +.klipse-container { + display: none; +} + +.klipse-separator { + display: none; +} + +.preview-anchor { + position: relative; +} + +.preview { + display: none; + position: absolute; + background-color: white; + border-radius: 6px; + box-shadow: 2px 4px 16px 0 rgba(0, 0, 0, 0.4); + padding: 0 1em; + bottom: 140%; + left: 50%; + width: 40em; + overflow: auto; + transform: translate(-25%, 0); + font-size: 90%; + z-index: 100000; + color: rgb(51, 51, 51); + font-weight: normal; + line-height: 1.5; + white-space: normal; +} + +.preview-anchor:hover .preview { + display: block; +} + +.markdown-body table { + overflow: inherit; +} + +.loading-message { + position: fixed; + display: block; + z-index: 100000; + bottom: 0px; + left: 0%; + right: 0%; + background: #e77; + padding: 0.5em 1em; + color: white; + opacity: 0.9; + text-align: center; +} + +.loading-hidden { + display: none; +} + +.menu .menu-body { + -ms-overflow-style: -ms-autohiding-scrollbar; + position: fixed; + display: flex; + left: 0; + top: 0; + height: 100%; + z-index: 10000; + white-space: nowrap; + font-size: 90%; + min-width: 20px; + max-width: 20px; + transition: all 250ms; + box-shadow: 2px 0 8px 0 rgba(0, 0, 0, 0.4); + background: #eee; + color: #000; + overflow-y: scroll; +} + +.menu.open .menu-body { + min-width: 40%; + max-width: 100%; + background: #fff; + color: #333; +} + +.menu .menu-side { + position: fixed; + top: 0; + left: 0; + height: 100%; + width: 20px; + text-align: center; + cursor: pointer; +} + +.menu .menu-overlay { + z-index: 1000; + position: fixed; + opacity: 0; + background: black; + top: 0; + left: 0; + width: 0; + height: 0; + transition: opacity 250ms; +} + +.menu.open .menu-overlay { + width: 100%; + height: 100%; + opacity: 0.5; +} + +.menu .menu-contents { + display: none; + padding: 0 2em 0 20px; +} + +.menu.open .menu-contents { + display: block; + margin-top: 1em; +} + +.menu .menu-contents ul { + list-style-type: none; + padding-left: 1em; +} diff --git a/docs/fw/tooltips.js b/docs/fw/tooltips.js new file mode 100644 index 0000000..0072c52 --- /dev/null +++ b/docs/fw/tooltips.js @@ -0,0 +1,58 @@ +;(function() { + 'use strict' + + function removeIds(elem) { + elem.removeAttribute('id') + for (var i = 0, n = elem.childElementCount; i < n; ++i) + removeIds(elem.children[i]) + return elem + } + + function addTips() { + var tips = [] + + function headerOf(elem) { + if (!elem) return null + if (/^H[1-6]$/.test(elem.tagName)) return elem + return headerOf(elem.parentElement) + } + + Array.prototype.slice + .call(document.querySelectorAll('a')) + .forEach(function(link) { + var href = link.getAttribute('href') + if (!href || href[0] !== '#' || href === '#') return + if (link.onclick) return + + var targetHeader = headerOf(document.querySelector(href)) + if (!targetHeader) return + + var linkHeader = headerOf(link) + if (linkHeader === targetHeader) return + + var targetSibling = targetHeader.nextElementSibling + if (!targetSibling) return + if (targetSibling.tagName !== 'P') return + + targetHeader = removeIds(targetHeader.cloneNode(true)) + targetSibling = removeIds(targetSibling.cloneNode(true)) + + tips.push({ + link: link, + targetHeader: targetHeader, + targetSibling: targetSibling + }) + }) + + tips.forEach(function(args) { + var preview = document.createElement('div') + preview.setAttribute('class', 'preview') + preview.appendChild(args.targetHeader) + preview.appendChild(args.targetSibling) + args.link.setAttribute('class', 'preview-anchor') + args.link.appendChild(preview) + }) + } + + window.addEventListener('load', addTips) +})() diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..4c6ce65 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,410 @@ + + +
+ ++ All the code snippets on this page are live and interactive + powered by the klipse + plugin. +
+This library provides a thin wrapper over the standard
+XMLHttpRequest
+API allowing one to perform XHRs by observing the state of ongoing requests as
+observable Kefir
+properties. The benefit
+of this approach is that it makes it easy to implement many kinds of use cases
+ranging from just getting the response data to visualizing the progress of
+ongoing upload and/or download and displaying potential errors. See also Karet
+FR.
Examples:
+XHR.allResponseHeaders(xhr) ~> string
XHR.headersReceived(xhr) ~> boolean
XHR.isDone(xhr) ~> boolean
XHR.readyState(xhr) ~> number
XHR.response(xhr) ~> varies
XHR.responseFull(xhr) ~> varies
XHR.responseHeader(header, xhr) ~> string
XHR.responseText(xhr) ~> string
XHR.responseType(xhr) ~> string
XHR.responseURL(xhr) ~> string
XHR.responseXML(xhr) ~> document
XHR.status(xhr) ~> number
XHR.statusIsHttpSuccess(xhr) ~> number
XHR.statusText(xhr) ~> string
XHR.timeout(xhr) ~> number
XHR.withCredentials(xhr) ~> boolean
XHR.downError(xhr) ~> exception
XHR.downHasEnded(xhr) ~> boolean
XHR.downHasFailed(xhr) ~> boolean
XHR.downHasStarted(xhr) ~> boolean
XHR.downHasSucceeded(xhr) ~> boolean
XHR.downHasTimedOut(xhr) ~> boolean
XHR.downIsProgressing(xhr) ~> boolean
XHR.downLoaded(xhr) ~> number
XHR.downTotal(xhr) ~> number
The interface of this library consists of named exports. Typically one just +imports the library as:
+import * as XHR from 'karet.xhr'
+Using this library, one first creates an observable property
+representing the state of an
+XMLHttpRequest
+using XHR.perform
and then observes the ongoing XHR state
+using the accessors for overall, download,
+and upload state.
XHR.getJson(url | {url,[, ...]}) ~> varies
XHR.getJson(arg)
is shorthand for
+XHR.responseFull(XHR.performJson(arg))
. See also
+XHR.performJson
.
XHR.performJson(url | {url[, ...]}) ~> xhr
XHR.performJson
is shorthand for XHR.performWith({responseType:
+'json'})
.
XHR.performWith(url | {...}, url | {...}) ~> xhr
XHR.performWith
is a curried function that allows one to define a
+XHR.perform
like function with default parameters. See
+XHR.perform
for the parameters.
For example:
+var get = XHR.performWith({responseType: 'json', timeout: 30*1000})
+// ...
+get(url)
+XHR.perform(url | {url[, method, user, password, headers, overrideMimeType, body, responseType, timeout, withCredentials]}) ~> xhr
XHR.perform
creates an observable
+property that represents
+the state of an ongoing
+XMLHttpRequest
.
+The request is started once the property is subscribed to and is automatically
+aborted
+in case the property is fully unsubscribed from before it has ended. See also
+XHR.performWith
.
Only the url
parameter is required and can be passed as a string. Other
+parameters have their XHR default values:
Parameter | +Default | +Explanation | +
---|---|---|
method |
+'GET' |
+HTTP request method to use. | +
user |
+null |
+User name for authentication. | +
password |
+null |
+Password for authentication. | +
headers |
+null |
+An array of [header, value] pairs, a plain object of {header: value} properties, a Map , or a Headers object mapping headers to values. |
+
overrideMimeType |
+undefined |
+If specified overrides the MIME type provided by the server. | +
body |
+null |
+A body of data to be sent. | +
responseType |
+'' |
+Specifies type of response data. | +
timeout |
+0 |
+Number of milliseconds or 0 for infinite. |
+
withCredentials |
+false |
+Whether cross-site Access-Control should use credentials. |
+
In addition to a plain object, the argument to XHR.perform
is allowed to be an
+observable property or contain observable properties, in which case the property
+created by XHR.perform
performs the XHR with the
+latest argument values.
Note that typically one does not explicitly subscribe to the property, but one +rather computes a desired view of the property, such as a view of the +response, and combines that further into some more interesting +property.
+WARNING: Setting responseType
to 'json'
is not supported by IE 11. This
+library implements a workaround by calling JSON.parse
on the returned data in
+case setting responseType
to 'json'
fails. In case the response does not
+parse, then XHR.response
and
+XHR.responseFull
return null
.
See this live GitHub repository search +CodeSandbox for an example.
+XHR.allResponseHeaders(xhr) ~> string
XHR.allResponseHeaders
returns a possibly observable property that emits the
+value of
+getAllResponseHeaders()
+after the HTTP headers have been received. When called on a non-observable XHR,
+its readyState
must be 2 or an Error
will be thrown.
XHR.headersReceived(xhr) ~> boolean
XHR.headersReceived
returns a possibly observable boolean property that tells
+whether HTTP headers have been received and can be obtained using
+XHR.allResponseHeaders
or
+XHR.responseHeader
.
XHR.isDone(xhr) ~> boolean
XHR.isDone
returns a possibly observable boolean property that tells whether
+the XHR operation is complete (whether success or failure).
XHR.readyState(xhr) ~> number
XHR.readyState
returns a possibly observable property of the
+readyState
+of an ongoing XHR.
XHR.response(xhr) ~> varies
XHR.response
returns a possibly observable property of the
+response
+of an ongoing XHR. See also XHR.responseFull
.
XHR.responseFull(xhr) ~> varies
XHR.responseFull
returns a possibly observable property that emits the
+response
+after the XHR has completed. When called on a non-observable XHR, its
+readyState
must be 4 or an Error
will be thrown. See also
+XHR.response
.
XHR.responseHeader(header, xhr) ~> string
XHR.responseHeader
returns a possibly observable property that emits the value
+of
+getResponseHeader(header)
+for specified header
after the HTTP headers have been received. When called
+on a non-observable XHR, its readyState
must be 2 or
+an Error
will be thrown.
XHR.responseText(xhr) ~> string
XHR.responseText
returns a possibly observable property of the
+responseText
+property of an ongoing XHR.
XHR.responseType(xhr) ~> string
XHR.responseType
returns a possibly observable property of the
+responseType
+of an ongoing XHR.
XHR.responseURL(xhr) ~> string
XHR.responseURL
returns a possibly observable property of the
+responseURL
+of an ongoing XHR.
XHR.responseXML(xhr) ~> document
XHR.responseXML
returns a possibly observable property of the
+responseXML
+property of an ongoing XHR.
XHR.status(xhr) ~> number
XHR.status
returns a possibly observable property of the
+status
+of an ongoing XHR.
XHR.statusIsHttpSuccess(xhr) ~> boolean
XHR.statusIsHttpSuccess(xhr)
is shorthand for
+XHR.isHttpSuccess(XHR.status(xhr))
. See also XHR.status
and
+XHR.isHttpSuccess
.
XHR.statusText(xhr) ~> string
XHR.statusText
returns a possibly observable property of the
+statusText
+of an ongoing XHR.
XHR.timeout(xhr) ~> number
XHR.timeout
returns a possibly observable property of the
+timeout
+property of an ongoing XHR.
XHR.withCredentials(xhr) ~> boolean
XHR.withCredentials
returns a possibly observable property of the
+withCredentials
+property of an ongoing XHR.
XHR.downError(xhr) ~> exception
XHR.downError
returns a possibly observable property of the
+error
property of
+a failed XHR.
XHR.downHasEnded(xhr) ~> boolean
XHR.downHasEnded
returns a possibly observable boolean property that tells
+whether the download operation of an ongoing XHR has
+ended.
XHR.downHasFailed(xhr) ~> boolean
XHR.downHasFailed
returns a possibly observable boolean property that tells
+whether the download operation of an ongoing XHR has
+failed.
XHR.downHasStarted(xhr) ~> boolean
XHR.downHasStarted
returns a possibly observable boolean property that tells
+whether the download operation of an ongoing XHR has
+started.
XHR.downHasSucceeded(xhr) ~> boolean
XHR.downHasSucceeded
returns a possibly observable boolean property that tells
+whether the download operation of an ongoing XHR has
+succeeded. Note
+that this does not take into account the HTTP response status, see
+XHR.status
and XHR.isHttpSuccess
.
XHR.downHasTimedOut(xhr) ~> boolean
XHR.downHasTimedOut
returns a possibly observable boolean property that tells
+whether the download operation of an ongoing XHR has timed
+out.
XHR.downIsProgressing(xhr) ~> boolean
XHR.downIsProgressing
returns a possibly observable boolean property that
+tells whether the download operation of an ongoing XHR is
+progressing.
XHR.downLoaded(xhr) ~> number
XHR.downLoaded
returns a possibly observable property of the
+loaded
+property of an ongoing XHR.
XHR.downTotal(xhr) ~> number
XHR.downTotal
returns a possibly observable property of the
+total
property
+of an ongoing XHR.
XHR.upError(xhr) ~> exception
XHR.upError
returns a possibly observable property of the
+error
property of
+a failed XHR.
XHR.upHasEnded(xhr) ~> boolean
XHR.upHasEnded
returns a possibly observable boolean property that tells
+whether the upload operation of an ongoing XHR has
+ended.
XHR.upHasFailed(xhr) ~> boolean
XHR.upHasFailed
returns a possibly observable boolean property that tells
+whether the upload operation of an ongoing XHR has
+failed.
XHR.upHasStarted(xhr) ~> boolean
XHR.upHasStarted
returns a possibly observable boolean property that tells
+whether the upload operation of an ongoing XHR has
+started.
XHR.upHasSucceeded(xhr) ~> boolean
XHR.upHasSucceeded
returns a possibly observable boolean property that tells
+whether the upload operation of an ongoing XHR has
+succeeded. Note
+that this does not take into account the HTTP response status, see
+XHR.status
and XHR.isHttpSuccess
.
XHR.upHasTimedOut(xhr) ~> boolean
XHR.upHasTimedOut
returns a possibly observable boolean property that tells
+whether the upload operation of an ongoing XHR has timed
+out.
XHR.upIsProgressing(xhr) ~> boolean
XHR.upIsProgressing
returns a possibly observable boolean property that tells
+whether the upload operation of an ongoing XHR is
+progressing.
XHR.upLoaded(xhr) ~> number
XHR.upLoaded
returns a possibly observable property of the
+loaded
+property of an ongoing XHR.
XHR.upTotal(xhr) ~> number
XHR.upTotal
returns a possibly observable property of the
+total
property
+of an ongoing XHR.
XHR.isHttpSuccess(number) ~> boolean
XHR.isHttpSuccess
returns a possibly observable property of whether the given
+numeric property is in the range 2xx of HTTP success
+codes.
+See also XHR.statusIsHttpSuccess
.
+ document.querySelector('.loading-message').className = "loading-hidden";
+ ga('send', 'event', 'completed', 'load', Math.round((Date.now() - startTime)/1000));
+ accelerate_klipse();
+
+