From fcbba2354877e8a9bd3c0638eca0a0c7133dabce Mon Sep 17 00:00:00 2001 From: Philippe Lhoste Date: Tue, 31 May 2016 16:00:18 +0200 Subject: [PATCH] Update version and readme --- README.md | 10 ++- examples/RxCustomObservable.js | 138 --------------------------------- package.json | 2 +- 3 files changed, 10 insertions(+), 140 deletions(-) delete mode 100644 examples/RxCustomObservable.js diff --git a/README.md b/README.md index 1d503cd..e4fd5de 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# RxNodeFS v. 0.2.0 +# RxNodeFS v. 0.2.1 + +Library to wrap Node.js' FS library (filesystem) in RxJS' Observables. +Currently only wrap directory reading (with optional recursion) and file reading. The [RxNodeFS](https://PhiLhoSoft.GitHub.io/) library exported as [Node.js](https://nodejs.org/) module. @@ -13,3 +16,8 @@ $ npm i --save RxNodeFS ## TODO Describe how it works... + +Meanwhile, see the JSDoc of the library, it is quite detailed. + +Also see the test file TestRxNodeFS, and the example CheckLocalConsistency: this one is actually the primary reason this library exists, as I didn't want to cumulate callbacks on successive file reading... + diff --git a/examples/RxCustomObservable.js b/examples/RxCustomObservable.js deleted file mode 100644 index b0f985e..0000000 --- a/examples/RxCustomObservable.js +++ /dev/null @@ -1,138 +0,0 @@ -// Make a RxJS custom observable, using the pattern seen in rx.angular.js and RxJS-DOM. -// This is a skeleton, with meaningless code at the core, it is only to show the pattern. - -/* global define */// Appeases ESLint -/* eslint no-invalid-this: 0 */ - -// UMD (global & AMD & Common.js) loader -(function __iife(root, factory) -{ - // The AMD way - if (typeof define == 'function' && define.amd) - { - define( - [ 'rx', 'other-lib', 'exports' ], - function (Rx, OtherLib, exports) - { - root.Rx = factory(root, exports, Rx, OtherLib); - return root.Rx; - } - ); - } - // The Common.js way - else if (typeof module == 'object' && module.exports) - { - module.exports = factory(root, module.exports, require('rx'), require('OtherLib')); - } - // Just make it global - else - { - root.Rx = factory(root, {}, root.Rx, root.OtherLib); - } -}(this, function __factory(root, exports, Rx, OtherLib) -{ - // Create the custom extension - Rx.Custom = {}; - - // New kind of observable - var CustomObservable = (function (__super__) - { - Rx.internals.inherits(CustomObservable, __super__); - - // Parameters useful to the working of the observable - function CustomObservable(name, something, listener, param) - { - this._name = name; - this._something = something; - this._listener = listener; - this._param = param; - - __super__.call(this); - } - - CustomObservable.prototype.subscribeCore = function (observable) - { - var result = {}; // Blabla - function process() - { - // Call - if (result === {}) - return observable.onError(new Error("That's bad")); - // Or call - observable.onNext(result); - } - process(); - - return new CustomDisposable(this._name); - }; - - function CustomDisposable(name) // Parameter list depends on what needs to be released - { - this._name = name; - - this.isDisposed = false; - } - - CustomDisposable.prototype.dispose = function () - { - if (!this.isDisposed) - { - this.isDisposed = true; - - delete this._name; // Real dispose code here - } - }; - - return CustomObservable; - }(Rx.ObservableBase)); - - /** - * Creates a generic custom observable. - * - * @param {Name} name The name of the observable - * @param {Object} something The something to process - * @param {Observer} progressObserver An observer to watch for progress. - * - * @returns {Observable} A custom observable - */ - Rx.Custom.createCustomObservable = function (name, something, progressObserver) - { - return new CustomObservable(name, something, progressObserver); // .publish().refCount(); - }; - - /** - * Creates an observable from something. - * - * @param {Object} something The something to process - * @param {Observer} progressObserver An observer to watch for progress. - * - * @returns {Object} An object which contains methods for processing something. - */ - Rx.Custom.fromSomething = function (something, progressObserver) - { - return { - /** - * Process the Something as a Foo as an Observable stream. - * - * @returns {Observable} An observable stream of a Foo - */ - asFoo: function () - { - return new CustomObservable('foo', something, progressObserver); - }, - /** - * Process the Something as a Bar as an Observable stream, with additional param. - * - * @param {Object} param The additional param - * - * @returns {Observable} An observable stream of a Bar - */ - asBar: function (param) - { - return new CustomObservable('bar', something, progressObserver, param); - }, - }; - }; - - return Rx; -})); diff --git a/package.json b/package.json index 285a6fd..e2f6bb8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "RxNodeFS", "version": "0.2.1", - "description": "Library", + "description": "Library to wrap Node.js' FS library (filesystem) in RxJS' Observables", "author": "PhiLho ", "license": "Zlib", "private": true,