super.sayHi(...Array.from(arguments))
to invoke the method on the parent super class.beforeReflex
and afterReflex
lifecycle callback methods to sample your performance. As a rule of thumb, anything below 200-300ms will be perceived as "native" by your users.beforeReflex
and afterReflex
to create UI spinners for anything that might take more than a heartbeat to complete. In addition to providing helpful visual feedback, research has demonstrated that acknowledging a slight delay will result in the user perceiving the delay as being shorter than they would if you did not acknowledge the delay. This is likely because we've been trained by good UI design to understand that this convention means we're waiting on the system. A sluggish UI otherwise forces people to wonder if they have done something wrong, and you don't want that.autofocus
attribute is only processed on the initial page load. If you want to implement a "click to edit" UI, you need to use a lifecycle callback method to make sure that the focus lands in the right place.afterReflex
callback to inspect the element to see if it has the autofocus
attribute and, if so, correctly set the focus on that element.autofocus
on an element that is a child of our controller. We used this.element where this is a reference to the Stimulus controller.Channel
class, it is the workhorse behind Sockpuppet. Take a look at the source code to learn more about what kind of updates you can do.dispatch_event
, which allows you to trigger any event in the client, including custom events and jQuery events.