From 565078468c6a8516f1d4fdc170052dee59320d06 Mon Sep 17 00:00:00 2001 From: Vesa Karvonen Date: Wed, 27 Jun 2018 16:07:32 +0300 Subject: [PATCH] Introduction --- README.md | 27 +++++++++++++++++++++++++++ docs/setup.js | 1 + klipse-github-docs.config.js | 9 +++++++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d224aba..751a680 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Examples: ## [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#contents) [Contents](#contents) +* [Introduction](#introduction) * [Reference](#reference) * [Convenience](#convenience) * [`XHR.getJson(url | {url[, ...]}) ~> varies`](#XHR-getJson) @@ -72,6 +73,32 @@ Examples: * [Auxiliary](#auxiliary) * [`XHR.isHttpSuccess(number) ~> boolean`](#XHR-isHttpSuccess) +## [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#introduction) [Introduction](#introduction) + +To-Be-Done + +```js +const searchRepositories = q => XHR.performJson( + U.string`https://api.github.com/search/repositories?q=${U.encodeURIComponent(q)}&sort=stars&order=desc` +) + +const logValues = observable => { + const value = console.log + setTimeout(() => U.on({value}, observable), 0) +} + +const xhr = searchRepositories('karet') + +logValues(U.string`${XHR.downLoaded(xhr)} bytes loaded`) +logValues( + L.collectAs( + ({full_name, stargazers_count}) => `${stargazers_count} ${full_name}`, + L.flat('items'), + XHR.responseFull(xhr) + ) +) +``` + ## [≡](#contents) [▶](https://calmm-js.github.io/karet.xhr/index.html#reference) [Reference](#reference) The interface of this library consists of named exports. Typically one just diff --git a/docs/setup.js b/docs/setup.js index 5ae1bd4..2053dc3 100644 --- a/docs/setup.js +++ b/docs/setup.js @@ -1,2 +1,3 @@ window.L = window.Kefir.partial.lenses +window.U = window.karet.util window.XHR = window.karet.xhr diff --git a/klipse-github-docs.config.js b/klipse-github-docs.config.js index 744abdf..b02dbf7 100644 --- a/klipse-github-docs.config.js +++ b/klipse-github-docs.config.js @@ -10,11 +10,16 @@ 'https://unpkg.com/partial.lenses/dist/partial.lenses.js', 'https://unpkg.com/partial.lenses.validation/dist/partial.lenses.validation.js', 'https://unpkg.com/kefir/dist/kefir.js', + 'https://unpkg.com/react/umd/react.production.min.js', + 'https://unpkg.com/karet/dist/karet.js', 'https://unpkg.com/karet.lift/dist/karet.lift.js', 'https://unpkg.com/kefir.partial.lenses/dist/kefir.partial.lenses.js', 'karet.xhr.js', - 'setup.js', - 'https://unpkg.com/ramda/dist/ramda.min.js' + 'https://unpkg.com/kefir.atom/dist/kefir.atom.js', + 'https://unpkg.com/kefir.combines/dist/kefir.combines.js', + 'https://unpkg.com/karet.util/dist/karet.util.js', + 'https://unpkg.com/ramda/dist/ramda.min.js', + 'setup.js' ], source: 'README.md', target: 'index.html',