Skip to content

Commit

Permalink
feat(state): Expose the internal state API via $$state()
Browse files Browse the repository at this point in the history
Closes #13
  • Loading branch information
christopherthielen committed Mar 26, 2016
1 parent 88c624d commit 92053f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/state/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ export interface StateDeclaration {
* ```
*/
parent?: (string|StateDeclaration);

/**
* Gets the private API portion of the state
*
* @hidden
*/
$$state?: () => State;

/**
* A property of [[StateDeclaration]]:
Expand Down
5 changes: 5 additions & 0 deletions src/state/stateBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export class StateBuilder {
const root = () => matcher.find("");

this.builders = {
self: [function (state: State) {
state.self.$$state = () => state;
return state.self;
}],

parent: [function (state: State) {
if (isRoot(state)) return null;
return matcher.find(self.parentName(state)) || root();
Expand Down

0 comments on commit 92053f1

Please sign in to comment.