Skip to content

Commit 459ae05

Browse files
refactor(TransitionHookType): Remove unused resolvePath property
1 parent 54dfb87 commit 459ae05

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

src/transition/transitionHookType.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,14 @@ import {GetErrorHandler, GetResultHandler, TransitionHook} from "./transitionHoo
1212
*/
1313
export class TransitionHookType {
1414

15-
public resolvePath: (trans: Transition) => PathNode[];
16-
1715
constructor(public name: string,
1816
public hookPhase: TransitionHookPhase,
1917
public hookScope: TransitionHookScope,
2018
public hookOrder: number,
2119
public criteriaMatchPath: string,
22-
resolvePath: ((trans: Transition) => PathNode[]) | string,
2320
public reverseSort: boolean = false,
2421
public getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,
2522
public getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,
2623
public rejectIfSuperseded: boolean = true,
27-
) {
28-
this.resolvePath = isString(resolvePath) ? (trans: Transition) => trans.treeChanges(resolvePath) : resolvePath;
29-
}
24+
) { }
3025
}

src/transition/transitionService.ts

+9-14
Original file line numberDiff line numberDiff line change
@@ -148,24 +148,19 @@ export class TransitionService implements IHookRegistry {
148148
const Phase = TransitionHookPhase;
149149
const TH = TransitionHook;
150150

151-
const to = (transition: Transition) =>
152-
transition.treeChanges('to');
153-
const from = (transition: Transition) =>
154-
transition.treeChanges('from');
155-
156151
let hookTypes = [
157-
new TransitionHookType("onCreate", Phase.CREATE, Scope.TRANSITION, 0, "to", to, false, TH.IGNORE_RESULT, TH.THROW_ERROR, false),
152+
new TransitionHookType("onCreate", Phase.CREATE, Scope.TRANSITION, 0, "to", false, TH.IGNORE_RESULT, TH.THROW_ERROR, false),
158153

159-
new TransitionHookType("onBefore", Phase.BEFORE, Scope.TRANSITION, 0, "to", to, false, TH.HANDLE_RESULT),
154+
new TransitionHookType("onBefore", Phase.BEFORE, Scope.TRANSITION, 0, "to", false, TH.HANDLE_RESULT),
160155

161-
new TransitionHookType("onStart", Phase.ASYNC, Scope.TRANSITION, 0, "to", to),
162-
new TransitionHookType("onExit", Phase.ASYNC, Scope.STATE, 10, "exiting", from, true),
163-
new TransitionHookType("onRetain", Phase.ASYNC, Scope.STATE, 20, "retained", to),
164-
new TransitionHookType("onEnter", Phase.ASYNC, Scope.STATE, 30, "entering", to),
165-
new TransitionHookType("onFinish", Phase.ASYNC, Scope.TRANSITION, 40, "to", to),
156+
new TransitionHookType("onStart", Phase.ASYNC, Scope.TRANSITION, 0, "to"),
157+
new TransitionHookType("onExit", Phase.ASYNC, Scope.STATE, 10, "exiting", true),
158+
new TransitionHookType("onRetain", Phase.ASYNC, Scope.STATE, 20, "retained"),
159+
new TransitionHookType("onEnter", Phase.ASYNC, Scope.STATE, 30, "entering"),
160+
new TransitionHookType("onFinish", Phase.ASYNC, Scope.TRANSITION, 40, "to"),
166161

167-
new TransitionHookType("onSuccess", Phase.SUCCESS, Scope.TRANSITION, 0, "to", to, false, TH.IGNORE_RESULT, TH.LOG_ERROR, false),
168-
new TransitionHookType("onError", Phase.ERROR, Scope.TRANSITION, 0, "to", to, false, TH.IGNORE_RESULT, TH.LOG_ERROR, false),
162+
new TransitionHookType("onSuccess", Phase.SUCCESS, Scope.TRANSITION, 0, "to", false, TH.IGNORE_RESULT, TH.LOG_ERROR, false),
163+
new TransitionHookType("onError", Phase.ERROR, Scope.TRANSITION, 0, "to", false, TH.IGNORE_RESULT, TH.LOG_ERROR, false),
169164
];
170165

171166
hookTypes.forEach(type => this[type.name] = this.registerTransitionHookType(type))

0 commit comments

Comments
 (0)