Skip to content

Instantly share code, notes, and snippets.

class Node extends Component {
componentDidMount() {
this.queueUpdate()
}
componentDidUpdate() {
this.queueUpdate()
}
queueUpdate = () => {
const render$ = new Subject()
const nodesEpic = (
action$,
state$,
) => (
action$
.pipe(
ofType(START_PROCESSING),
delay(0),
tempQueue
.forEach((
handler,
) => {
handler()
})
store
.queue
.push(
this
.updateState
)
class Node extends Component {
constructor(props) {
super(props)
const {
initialColor,
initialValue,
} = props
this
class Node extends Component {
componentDidMount() {
this.queueUpdate()
}
componentDidUpdate() {
this.queueUpdate()
}
queueUpdate = () => {
const queue1 = []
const queue2 = []
let timeoutIds = {}
let queue = queue1
const clearQueue = (
queue,
) => {
queue
const node = (
document
.getElementById(`node-${id}`)
)
node.innerHTML = getRandomValue()
node.style.color = getRandomColor()
// [Action] ADD_TO_QUEUE
// [Action] ADD_TO_QUEUE
// [Action] ADD_TO_QUEUE
// [Action] START_PROCESSING_QUEUE
// Processing value: A
// [Action] REMOVE_FROM_QUEUE
// 'A' is done
// [Action] FINISHED_PROCESSING_ITEM
// Processing value: B
// [Action] REMOVE_FROM_QUEUE
const { delay, filter, map, mapTo, mergeAll, mergeMap, scan, switchMap, tap } = require('rxjs/operators')
const { of, Subject } = require('rxjs')
const { ofType } = require('redux-observable')
const ADD_TO_QUEUE = 'ADD_TO_QUEUE'
const FINISHED_PROCESSING_ITEM = 'FINISHED_PROCESSING_ITEM'
const REMOVE_FROM_QUEUE = 'REMOVE_FROM_QUEUE'
const START_PROCESSING_QUEUE = 'START_PROCESSING_QUEUE'
const queueReducer = (