Cleaned up code to fire event when the webcomponent is ready
This patch potentially spawns an event listener to invoke document.register.
This could be an issue.