M
M
myaca2019-08-11 02:19:34
JavaScript
myaca, 2019-08-11 02:19:34

Rxjs - how to do data change monitoring?

https://stackblitz.com/edit/typescript-l75wse?file...

import { Observable, from } from "rxjs";

const arr = [1,2,3]
var observable = from(arr)
arr.push(22)

setTimeout(() => {
    var subscription = observable.subscribe(
        (x:any) => console.log(x)
    )
},2000);


arr.push(333)

setTimeout(() => arr.push(4444), 5000)

i want to subscribe to array changes, how can i do that? Those. so that the last set-timeout case emits values.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question