src/State.js
function init(router, name, parent) {
    state.router = router
    state.name = name
    state.isDefault = name == '_default_'
    state.parent = parent
    state.parents = getParents()
    state.root = state.parent ? state.parents[state.parents.length - 1] : state
    state.children = util.objectToArray(states)
    state.fullName = getFullName()
    state.asPublic = makePublicAPI()

    eachChildState((name, childState) => {
      childState.init(router, name, state)
    })
  }
function init(router, name, parent) {
    state.router = router
    state.name = name
    state.isDefault = name == '_default_'
    state.parent = parent
    state.parents = getParents()
    state.root = state.parent ? state.parents[state.parents.length - 1] : state
    state.children = util.objectToArray(states)
    state.fullName = getFullName()
    state.asPublic = makePublicAPI()

    eachChildState((name, childState) => {
      childState.init(router, name, state)
    })
  }
/*
Initialize and freeze this state.