francis

所属分类:网络编程
开发工具:TypeScript
文件大小:0KB
下载次数:0
上传日期:2019-04-01 21:05:02
上 传 者sh-1993
说明:  React编程,专注于开发人员友好的流语义、高性能和功能使用,
(Reactive programming with focus on developer friendly stream semantics, high performance and functional usage,)

文件列表:
.npmignore (106, 2019-04-01)
.prettierrc (206, 2019-04-01)
.travis.yml (209, 2019-04-01)
BACON.md (1974, 2019-04-01)
LICENSE (1076, 2019-04-01)
bacon.d.ts (28, 2019-04-01)
bacon.js (49, 2019-04-01)
build/ (0, 2019-04-01)
build/bacon.umd.config.js (730, 2019-04-01)
build/bacon.umd.min.config.js (843, 2019-04-01)
build/francis.esm.config.js (788, 2019-04-01)
build/francis.umd.config.js (724, 2019-04-01)
build/francis.umd.min.config.js (837, 2019-04-01)
docs/ (0, 2019-04-01)
docs/.babelrc (44, 2019-04-01)
docs/INTRODUCTION.md (1202, 2019-04-01)
docs/api.json (24621, 2019-04-01)
docs/app.css (1646, 2019-04-01)
docs/index.html (131832, 2019-04-01)
docs/package-lock.json (391129, 2019-04-01)
docs/package.json (930, 2019-04-01)
docs/src/ (0, 2019-04-01)
docs/src/buildDocs.js (1246, 2019-04-01)
docs/src/dev.html (564, 2019-04-01)
docs/src/dev.js (608, 2019-04-01)
docs/src/extractApi.ts (5582, 2019-04-01)
docs/src/ui.js (6814, 2019-04-01)
docs/tsconfig.json (201, 2019-04-01)
package-lock.json (225314, 2019-04-01)
package.json (2465, 2019-04-01)
perf/ (0, 2019-04-01)
perf/_base.js (2716, 2019-04-01)
perf/_libs.js (941, 2019-04-01)
perf/_util.js (374, 2019-04-01)
perf/index.js (1684, 2019-04-01)
perf/memtest.js (4930, 2019-04-01)
perf/package-lock.json (251106, 2019-04-01)
... ...

# Francis [![Build status](https://img.shields.io/travis/milankinen/francis/master.svg?style=flat-square)](https://travis-ci.org/milankinen/francis) [![npm](https://img.shields.io/npm/v/francis.svg?style=flat-square)](https://www.npmjs.com/package/francis) [![Bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/francis.svg?style=flat-square)](https://bundlephobia.com/result?p=francis) [![Dependencies](https://david-dm.org/milankinen/francis.svg?style=flat-square)](https://github.com/milankinen/francis/blob/master/package.json) Francis is a reactive programming library for TypeScript and JavaScript, inspired by [Bacon.js](https://github.com/baconjs/bacon.js) and [most](https://github.com/cujojs/most), with focus on developer friendly stream semantics, high performance and functional usage. ```typescript import * as F from "francis" F.pipe( F.interval(1000, "!"), F.scan("Francis", (s, x) => s + x), F.map(s => "Hello " + s.toUpperCase()), F.skip(2), F.take(2), F.onValue(console.log), ) // Hello FRANCIS!! // Hello FRANCIS!!! ``` ## Motivation **tl;dr** I wanted a functional-first, treeshakeable [Bacon.js](https://github.com/baconjs/bacon.js) that is [6-10x faster](perf#latest-test-results), has lower memory footprint and is written entirely with TypeScript. ## Installation ```bash npm i --save francis ``` ## API See **[API docs](https://milankinen.github.io/francis)** (still WIP!) for complete reference of the available functions and their usage. ### Bacon.js compatibility Because the stream semantics are same (with [few differences](BACON.md)) in Francis and Bacon, Francis provides a drop-in replacement module for Bacon. The required changes in codebase are: ```diff -import B from "baconjs" +import B from "francis/bacon" B.once("Bacon") .map(x => "Hello " + x + "!") .map(".toUpperCase") .onValue(console.log) ``` ### Experimental proxied API You can convert any Francis observable to a "proxied" observable by using `F.proxied` utility. Proxied observables are just like their "normal" counterparts, but in addition they provide a way to traverse the underlying data structure by using the traditional dot notation. And being typed, of course. **ATTENTION!** This feature is experimental and is probably subject to change. ```ts import * as F from "francis" const state = F.proxied( F.atom({ msg: "Tsers", inner: { nums: [1, 2, 4, 5] }, }), ) // typeof nums === F.Proxied.Atom const { nums } = state.inner // typeof str === F.Proxied.Property const str = nums .map(n => n + 1) .filter(n => n % 2 === 1) .join(",") F.log("str:", str) F.set(nums, [5, 6]) // logs "3,5" and "7" ``` ## License MIT

近期下载者

相关文件


收藏者