Merge pull request #8520 from colinux/fix-stimulus-on-handler

fix(stimulus): "on" handler having target
This commit is contained in:
Colin Darie 2023-01-30 11:52:06 +01:00 committed by GitHub
commit 17141a26d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,7 +65,10 @@ export class ApplicationController extends Controller {
FOCUS_EVENTS.includes(targetOrEventName) FOCUS_EVENTS.includes(targetOrEventName)
); );
} else { } else {
invariant(eventNameOrHandler == 'string', 'event name is required'); invariant(
typeof eventNameOrHandler == 'string',
'event name is required'
);
invariant(handler, 'handler is required'); invariant(handler, 'handler is required');
this.onTarget(targetOrEventName, eventNameOrHandler, handler); this.onTarget(targetOrEventName, eventNameOrHandler, handler);
} }