yysun / apprun

AppRun is a JavaScript library for developing high-performance and reliable web applications using the elm inspired architecture, events and components.

Home Page:https://apprun.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a way to trigger event from console?

jkleiser opened this issue · comments

This is probably a stupid question, but I'm not sure if and how it can be done. I'm currently working on a new and improved version of a board game (Chinese Checkers) I wrote some years ago. My SPA has a button that lets me (developer) trigger an automatic valid move on the board; the event name is "autoMove". Is it possible for me to fire that event by a command in the console?
I have checked Ch. 12 on DevTools in the AppRun book, but I'm not sure if the answer to my question can be found there.

You can just type app.run('autoMove') in the console.

I just tried that, but I get "Assertion failed: No subscriber for event: autoMove", with a reference to app.ts 35.

I read a little more on page 98 in the book which explained that I had to make my event into a global event. Now I can do app.run('#autoMove') in the console. Thanks.