Skip to content

Conversation

nhunzaker
Copy link
Contributor

@nhunzaker nhunzaker commented Nov 29, 2016

I want to slowly move towards Domains just being Microcosms mounted at paths to other Microcosms:

import Domain from 'microcosm/domain'

class Node {
  getInitialState() { return [] }
}

class Edge {
  getInitialState() { return [] }
}

class Network extends Domain {
  setup () {
    this.addDomain('nodes', Nodes)
    this.addDomain('edges', Edges)
  }
}

const repo = new Microcosm()

repo.addDomain('network', Network)

expect(repo.state.network.edges).toEqual([])
expect(repo.state.network.nodes).toEqual([])

I also updated error messages to correctly encounter non-function keys (and respond with null):

Unable to register `action.done` at domain path `["network", "nodes"]`. Handlers must be
functions, instead got `undefined`. Check the register method for this domain.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 264e5ed on sub-domains into 65f952c on master.

@nhunzaker
Copy link
Contributor Author

Closing this out after I mused over it a while. See #184

@nhunzaker nhunzaker closed this Dec 1, 2016
@nhunzaker nhunzaker deleted the sub-domains branch February 13, 2017 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants