function baseState(node, property, val) {
    var currentVal = node.itree.state[property];
    if (typeof val !== 'undefined' && currentVal !== val) {
      // Update values
      node.itree.state[property] = val;
      if (property !== 'rendered') {
        node.markDirty();
      }

      // Emit an event
      node._tree.emit('node.state.changed', node, property, currentVal, val);
    }
    return currentVal;
  }
Get or set a state value.

This is a base method and will not invoke related changes, for example
setting selected=false will not trigger any deselection logic.

@private
@param {TreeNode} node Tree node.
@param {string} property Property name.
@param {boolean} val New value, if setting.
@return {boolean} Current value on read, old value on set.