evg_observable 1.14.54 → 1.14.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ features that make it stand out from the rest:
|
|
|
70
70
|
## Observable simple usage
|
|
71
71
|
|
|
72
72
|
```ts
|
|
73
|
-
import {Observable} from "evg_observable
|
|
73
|
+
import {Observable} from "evg_observable";
|
|
74
74
|
|
|
75
75
|
const observable$ = new Observable('Some typed data (not only string)');
|
|
76
76
|
|
|
@@ -147,7 +147,7 @@ observable$.destroy(); // all subscribers have automatically unsubscribed
|
|
|
147
147
|
Observable will send a value to the subscriber only once, and the subscriber will unsubscribe.
|
|
148
148
|
|
|
149
149
|
```ts
|
|
150
|
-
import {Observable} from "evg_observable
|
|
150
|
+
import {Observable} from "evg_observable";
|
|
151
151
|
|
|
152
152
|
const observable$ = new Observable('Some typed data (not only string)');
|
|
153
153
|
const listener1 = (value: string) => console.log('listener1:', value);
|
|
@@ -178,7 +178,7 @@ Observable will send a value to the subscriber as long as the condition is negat
|
|
|
178
178
|
subscriber will unsubscribe.
|
|
179
179
|
|
|
180
180
|
```ts
|
|
181
|
-
import {Observable} from "evg_observable
|
|
181
|
+
import {Observable} from "evg_observable";
|
|
182
182
|
|
|
183
183
|
type ISomeData = {
|
|
184
184
|
message: string;
|
|
@@ -222,7 +222,7 @@ Observable will send a value to the subscriber only if the return value of the c
|
|
|
222
222
|
this case, there is no automatic unsubscription.
|
|
223
223
|
|
|
224
224
|
```ts
|
|
225
|
-
import {Observable} from "evg_observable
|
|
225
|
+
import {Observable} from "evg_observable";
|
|
226
226
|
|
|
227
227
|
const observable$ = new Observable('Some typed data (not only string)');
|
|
228
228
|
const listener1 = (value: string) => console.log('listener1:', value);
|
|
@@ -265,7 +265,7 @@ Return Value: An ISetup<string> object.
|
|
|
265
265
|
Usage Example:
|
|
266
266
|
|
|
267
267
|
```ts
|
|
268
|
-
import {Observable} from "evg_observable
|
|
268
|
+
import {Observable} from "evg_observable";
|
|
269
269
|
type IPoint = { x: number, y: number };
|
|
270
270
|
|
|
271
271
|
const rawObject: IPoint = {x: 10, y: 20};
|
|
@@ -290,7 +290,7 @@ Return Value: An ISetup<K> object, where K is the type of data resulting f
|
|
|
290
290
|
Usage Example:
|
|
291
291
|
|
|
292
292
|
```ts
|
|
293
|
-
import {Observable} from "evg_observable
|
|
293
|
+
import {Observable} from "evg_observable";
|
|
294
294
|
type IPoint = { x: number, y: number };
|
|
295
295
|
|
|
296
296
|
const rawObject: IPoint = {x: 10, y: 20};
|
|
@@ -314,7 +314,7 @@ Ordered observable - differs from Observable in that it allows you to emit messa
|
|
|
314
314
|
are the same.
|
|
315
315
|
|
|
316
316
|
```ts
|
|
317
|
-
import {OrderedObservable} from "evg_observable
|
|
317
|
+
import {OrderedObservable} from "evg_observable";
|
|
318
318
|
|
|
319
319
|
const observable$ = new OrderedObservable('Some typed data (not only string)');
|
|
320
320
|
const listener1 = (value: string) => console.log('listener1:', value);
|
|
@@ -360,8 +360,8 @@ observable$.next('SOME DATA');
|
|
|
360
360
|
You can also use the subscriber collector for convenience.
|
|
361
361
|
|
|
362
362
|
```ts
|
|
363
|
-
import {Observable} from "evg_observable
|
|
364
|
-
import {Collector} from "evg_observable
|
|
363
|
+
import {Observable} from "evg_observable";
|
|
364
|
+
import {Collector} from "evg_observable";
|
|
365
365
|
|
|
366
366
|
const collector = new Collector();
|
|
367
367
|
const observable$ = new Observable('Some typed data (not only string)');
|
|
@@ -407,7 +407,7 @@ updates:
|
|
|
407
407
|
|
|
408
408
|
```typescript
|
|
409
409
|
// Import the Observable library
|
|
410
|
-
import {Observable} from "evg_observable
|
|
410
|
+
import {Observable} from "evg_observable";
|
|
411
411
|
|
|
412
412
|
// Constants representing different hair colors
|
|
413
413
|
const HAIR = {
|
|
@@ -554,6 +554,8 @@ payload data in the pipe chain by applying a user callback function.
|
|
|
554
554
|
Here is the syntax:
|
|
555
555
|
|
|
556
556
|
```typescript
|
|
557
|
+
import {Observable} from "evg_observable";
|
|
558
|
+
|
|
557
559
|
const targetObservable$ = new Observable("");
|
|
558
560
|
const targetListener = (num: number) => console.log(num);
|
|
559
561
|
|