Create class operators

1. Definition of creation: These operators do not depend on any other Observable, so they can create an Observable out of thin air or based on other data sources.

2. Create class operators are the source of the data, so most create class operators are static operators

Create a synchronous data stream

1. For synchronous data flows, the time interval between data can be ignored.

2. Create is the simplest operation. Inside, it simply calls the Observable constructor without importing any other modules. (static)

The source code is shown in figure:

3. Of is used to enumerate data. The generated data is synchronous, and the Observable also ends after the data is generated. (Static) Application scenario: Want to convert a few known data into an Observable for processing. Ps: This method is called just in RXJS 4, so if you want to upgrade RXJS, you need to rename the operation.

The first argument does not have to be an integer, but can be 1.5 or any other number, incrementing by 1 each time. (Static) Application scenario: Generate a large sequence of consecutive numbers.

The first parameter is a value, the initial value, the second parameter is a function, the condition to continue, the third parameter is a function, the increment of the value, and the third parameter is a function, the result. Keep all three functions pure. (Static) Use scenario: If you use a for loop implementation in JS, which RXJS implementation can use generate.

6. Repeate, a data stream that repeats data, can repeat the data in the upstream Observable for several times, and will not be executed until the upstream Observable finishes its execution. If the upstream Observable does not execute complete, repeate cannot be executed normally. (dynamic) ps: This method is a static operator in RXJS 4 and can take two arguments, the first is the object of the loop and the second is the number of loops.

7. Empty generates a completed Observable with no parameters and no data.

An Observable does nothing but report an error, passing in an error message as an argument. Ps: Note that throw is a keyword in js and can be imported using an alias.

Never really do anything until forever.