Skip to content

Commit

Permalink
feat(onEnter/Exit/Retain): Use onExit/onEnter/onRetain from 56955stat…
Browse files Browse the repository at this point in the history
…e(), not state.self
  • Loading branch information
christopherthielen committed Feb 26, 2017
1 parent 6aefc06 commit bc1f554
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/hooks/onEnterExitRetain.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/** @module hooks */ /** for typedoc */
import {TransitionStateHookFn} from "../transition/interface";
import {Transition} from "../transition/transition";
import {TransitionService} from "../transition/transitionService";
/** @module hooks */
/** for typedoc */
import { TransitionStateHookFn } from '../transition/interface';
import { Transition } from '../transition/transition';
import { TransitionService } from '../transition/transitionService';
import { StateDeclaration } from '../state/interface';
import { StateObject } from '../state/stateObject';

/**
* A factory which creates an onEnter, onExit or onRetain transition hook function
Expand All @@ -14,7 +16,8 @@ import { StateDeclaration } from '../state/interface';
*/
function makeEnterExitRetainHook(hookName: string): TransitionStateHookFn {
return (transition: Transition, state: StateDeclaration) => {
let hookFn: TransitionStateHookFn = state[hookName];
let _state: StateObject = state.$$state();
let hookFn: TransitionStateHookFn = _state[hookName];
return hookFn(transition, state);
}
}
Expand Down

0 comments on commit bc1f554

Please sign in to comment.