I have a bunch of widgets/components that currently only consist of HTML which are dynamically loaded. Right now,

processMessage()

basically just said "If msg.id = widget1 then do a bunch of stuff". I would like to modify the component files to include javascript that handles all the widget data, and some how register a hook to detect when a