github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/public/libs/vue-1.0.24/src/transition/queue.js (about)

     1  import { nextTick } from '../util/index'
     2  
     3  let queue = []
     4  let queued = false
     5  
     6  /**
     7   * Push a job into the queue.
     8   *
     9   * @param {Function} job
    10   */
    11  
    12  export function pushJob (job) {
    13    queue.push(job)
    14    if (!queued) {
    15      queued = true
    16      nextTick(flush)
    17    }
    18  }
    19  
    20  /**
    21   * Flush the queue, and do one forced reflow before
    22   * triggering transitions.
    23   */
    24  
    25  function flush () {
    26    // Force layout
    27    var f = document.documentElement.offsetHeight
    28    for (var i = 0; i < queue.length; i++) {
    29      queue[i]()
    30    }
    31    queue = []
    32    queued = false
    33    // dummy return, so js linters don't complain about
    34    // unused variable f
    35    return f
    36  }