old_contents: let scheduler = null
  
  export function setScheduler (customScheduler) {
    if (customScheduler) {
      scheduler = customScheduler
    } else {
      scheduler = new DefaultScheduler()
    }
  }
  
  export function getScheduler () {
    return scheduler
  }
  
  class DefaultScheduler {
    constructor () {
      this.updateRequests = []
      this.frameRequested = false
      this.performUpdates = this.performUpdates.bind(this)
    }
  
    updateDocument (fn) {
      this.updateRequests.push(fn)
      if (!this.frameRequested) {
        this.frameRequested = true
        window.requestAnimationFrame(this.performUpdates)
      }
    }
  
    performUpdates () {
      this.frameRequested = false
  
      while (this.updateRequests.length > 0) {
        this.updateRequests.shift()()
      }
    }
  }
  
new_contents: let scheduler = null
  
  export function setScheduler (customScheduler) {
    scheduler = customScheduler
  }
  
  export function getScheduler () {
    if (!scheduler) {
      scheduler = new DefaultScheduler()
    }
    return scheduler
  }
  
  class DefaultScheduler {
    constructor () {
      this.updateRequests = []
      this.frameRequested = false
      this.performUpdates = this.performUpdates.bind(this)
    }
  
    updateDocument (fn) {
      this.updateRequests.push(fn)
      if (!this.frameRequested) {
        this.frameRequested = true
        window.requestAnimationFrame(this.performUpdates)
      }
    }
  
    performUpdates () {
      this.frameRequested = false
  
      while (this.updateRequests.length > 0) {
        this.updateRequests.shift()()
      }
    }
  }
  
subject: Use the DefaultScheduler if none is assigned