Skip to content

Commit df17c40

Browse files
committed
fix review comment: why not move eventName above the if statement here? so that way we aren't defining two variables that have the same value?
1 parent 53ece6a commit df17c40

File tree

1 file changed

+6
-7
lines changed
  • packages/@glimmer/runtime/lib/modifiers

1 file changed

+6
-7
lines changed

packages/@glimmer/runtime/lib/modifiers/on.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,18 @@ export class OnModifierState {
5858
let { element, args, listener } = this;
5959

6060
let arg0 = args.positional[0];
61-
62-
if (DEBUG && !arg0) {
63-
throw new Error(
64-
'You must pass a valid DOM event name as the first argument to the `on` modifier'
65-
);
66-
}
67-
6861
let eventName = check(
6962
arg0 ? valueForRef(arg0) : undefined,
7063
CheckString,
7164
() => 'You must pass a valid DOM event name as the first argument to the `on` modifier'
7265
);
7366

67+
if (DEBUG && !eventName) {
68+
throw new Error(
69+
'You must pass a valid DOM event name as the first argument to the `on` modifier'
70+
);
71+
}
72+
7473
let arg1 = args.positional[1];
7574
let userProvidedCallback = check(
7675
arg1 ? valueForRef(arg1) : undefined,

0 commit comments

Comments
 (0)