packages/mip/src/components/mip-bind/watcher.js
function flushWatcherQueue () {
  flushing = true
  let watcher
  let id

  queue.sort((a, b) => a.id - b.id)

  for (index = 0; index < queue.length; index++) {
    watcher = queue[index]
    id = watcher.id
    has[id] = null
    watcher.run()
    // in dev build, check and stop circular updates.
    if (process.env.NODE_ENV !== 'production') {
      circular[id] = (circular[id] || 0) + 1
      if (circular[id] > MAX_UPDATE_COUNT) {
        console.error(
          `[MIP warn]:You may have an infinite update loop in watcher with expression "${watcher.exp}"`
        )
        break
      }
    }
  }

  resetState()
}
function flushWatcherQueue () {
  flushing = true
  let watcher
  let id

  queue.sort((a, b) => a.id - b.id)

  for (index = 0; index < queue.length; index++) {
    watcher = queue[index]
    id = watcher.id
    has[id] = null
    watcher.run()
    // in dev build, check and stop circular updates.
    if (process.env.NODE_ENV !== 'production') {
      circular[id] = (circular[id] || 0) + 1
      if (circular[id] > MAX_UPDATE_COUNT) {
        console.error(
          `[MIP warn]:You may have an infinite update loop in watcher with expression "${watcher.exp}"`
        )
        break
      }
    }
  }

  resetState()
}
function flushWatcherQueue ( ) { flushing = true let watcher let id queue . sort ( ( a , b ) => a . id - b . id ) for ( index = 0 ; index < queue . length ; index ++ ) { watcher = queue [ index ] id = watcher . id has [ id ] = null watcher . run ( ) // in dev build, check and stop circular updates. if ( process . env . NODE_ENV !== 'production' ) { circular [ id ] = ( circular [ id ] || 0 ) + 1 if ( circular [ id ] > MAX_UPDATE_COUNT ) { console . error ( ` ${ watcher . exp } ` ) break } } } resetState ( ) }
Flush queues and run the watchers.
Flush queues and run the watchers .