rxjs-observable-collections
所属分类:网络编程
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2019-01-04 19:35:34
上 传 者:
sh-1993
说明: 集合类(Array、Set、Map、WeakSet、WeakMap)的实现,这些集合类公开指示何时发生变异的可观察项,
(Implementations of collection classes (Array, Set, Map, WeakSet, WeakMap) which expose observables indicating when they are mutated,)
文件列表:
.babelrc (176, 2019-01-04)
.flowconfig (58, 2019-01-04)
.npmignore (125, 2019-01-04)
.travis.yml (39, 2019-01-04)
LICENSE (1061, 2019-01-04)
flow-typed/ (0, 2019-01-04)
flow-typed/npm/ (0, 2019-01-04)
flow-typed/npm/@babel/ (0, 2019-01-04)
flow-typed/npm/@babel/core_vx.x.x.js (9627, 2019-01-04)
flow-typed/npm/@babel/plugin-proposal-class-properties_vx.x.x.js (1019, 2019-01-04)
flow-typed/npm/@babel/polyfill_v7.x.x.js (167, 2019-01-04)
flow-typed/npm/@babel/preset-env_vx.x.x.js (4588, 2019-01-04)
flow-typed/npm/@babel/preset-flow_vx.x.x.js (893, 2019-01-04)
flow-typed/npm/babel-loader_vx.x.x.js (1630, 2019-01-04)
flow-typed/npm/flow-bin_v0.x.x.js (188, 2019-01-04)
flow-typed/npm/flow-typed_vx.x.x.js (5763, 2019-01-04)
flow-typed/npm/jasmine_v2.4.x.js (3223, 2019-01-04)
flow-typed/npm/jasmine_vx.x.x.js (146, 2019-01-04)
flow-typed/npm/karma-babel-preprocessor_vx.x.x.js (2101, 2019-01-04)
flow-typed/npm/karma-chrome-launcher_vx.x.x.js (1896, 2019-01-04)
flow-typed/npm/karma-jasmine_vx.x.x.js (1424, 2019-01-04)
flow-typed/npm/karma-webpack_vx.x.x.js (1296, 2019-01-04)
flow-typed/npm/karma_vx.x.x.js (12834, 2019-01-04)
flow-typed/npm/rxjs_v6.x.x.js (107612, 2019-01-04)
flow-typed/npm/webpack_v4.x.x.js (12789, 2019-01-04)
flow-typed/npm/window_vx.x.x.js (1158, 2019-01-04)
karma.conf.js (1314, 2019-01-04)
package-lock.json (290613, 2019-01-04)
package.json (1936, 2019-01-04)
rxjs-observable-collections.code-workspace (60, 2019-01-04)
src/ (0, 2019-01-04)
src/ArrayAction.js (4239, 2019-01-04)
src/MapAction.js (1948, 2019-01-04)
src/ObservableArray.js (5875, 2019-01-04)
src/ObservableArray.spec.js (13510, 2019-01-04)
src/ObservableClearableWeakMapWrapper.js (2306, 2019-01-04)
src/ObservableClearableWeakMapWrapper.spec.js (2171, 2019-01-04)
src/ObservableClearableWeakSetWrapper.js (2201, 2019-01-04)
... ...
The **[Observable Collections](https://www.npmjs.com/package/rxjs-observable-collections)** module provides implementations of JavaScript/ECMAScript 'collection' objects which emit [an rxjs observable action stream] as they are mutated: Array, Set, Map, WeakSet & WeakMap. Reactive applications which use **rxjs** may subscribe/observe these actions to synchronise logic with modifications to those collections.
Here is *an annotated minimal example* showing the usage of an [observable Array]. You may notice that it uses ECMAScript 2015 syntax. This module is usable in any environment which [supports ECMAScript 5+]; in practice that's Internet Explorer 9+ and *all other modern browsers*.
```js
const myArray = new ObservableArray();
// Immediately, the initial (empty) state
// of the array will be logged
const subscription = myArray.actions
.subscribe(action => console.log(action));
// As the item is pushed, a 'push' action
// will also be logged
myArray.push('An item');
// Tidy up after ourselves
subscription.unsubscribe();
```
[**Full documentation** is available] on this repository's wiki.
[an rxjs observable action stream]: https://rxjs-dev.firebaseapp.com/
[observable Array]: https://github.com/csf-dev/rxjs-observable-collections/wiki/ObservableArray
[observable arrays]: https://github.com/csf-dev/rxjs-observable-collections/wiki/ObservableArray
[supports ECMAScript 5+]: https://github.com/csf-dev/rxjs-observable-collections/wiki#browserenvironment-support
[**Full documentation** is available]: https://github.com/csf-dev/rxjs-observable-collections/wiki
## Limitations
In order to provide [the range of browser & environment support], this module has to accept *two limitations, applicable to [observable arrays]*. Specifically, no observable actions are emitted when either:
* Using *brackets notation* to set array items by index
* The array is *resized* via its `length` property
[These limitations are covered at length], with information how they may be rectified someday. At present the solution is deemed to be too 'costly' in terms of browser support. For example, it would exclude *all* versions of Internet Explorer.
[the range of browser & environment support]: https://github.com/csf-dev/rxjs-observable-collections/wiki#browserenvironment-support
[These limitations are covered at length]: https://github.com/csf-dev/rxjs-observable-collections/issues/4
### Workaround
As a workaround to these limitations, two additional functions are available for observable arrays.
```js
// Sets an item by index
myArray.setItem(3, 'replacement item');
// Resizes the array
myArray.resize(20);
```
These functions have the same functionality as the two scenarios described above but also emit the observable action as expected.
近期下载者:
相关文件:
收藏者: