Subscribes to a list of events in a widget. The widget usually is stored in a state
and initialized by setting the widgetRef on a component created using
componentFromWidget.
In most situations using on<EventName> properties on widgets is a better
alternative.
useWidgetEvents(widget, events);widget: Widget- The widget instance.events: Record<string,function>- The events and callbacks to subscribe to.