Added ability to trigger events from javascript