I have the following observable that gets pages
on a workspace
:
page$ = this.pageService.getPages(this.workspaceId) // .subscribe() to get data
This is updated periodically when a new page is added.
I want to save the array of pages before and after a new page (or a stream of pages) is added, and then be able to compare them.
For example, on init, if there are three pages, arrayOld would be of the three pages. Then, there would be a new array made, arrayNew, of four pages if one new page was added.
If a page was then deleted, arrayOld would become arrayNew (length of 4), and arrayNew would become the new set of pages (of length 3).
I have yet to find an easy way to accomplish this using subscribe()
to the current stream of pages.
Any help here would be amazing. Thank you!