code: function (state) {
      if (this.state === state) {
        return Promise.resolve()
      }
  
      var node = this
      return new Promise(function (resolve) {
        var unbind = node.on('state', function () {
          if (node.state === state) {
            unbind()
            resolve()
          }
        })
      })
    }
docs: Return Promise until {@link BaseNode#state} sync will have specific state.
  
  If current state is correct, method will return resolved Promise.
  
  @param {string} state The expected synchronization state value.
  
  @return {Promise} Promise until specific state.
  
  @example
  await node.waitFor('synchronized')
  console.log('Everything is synchronized')