cleanup of widget_api.js and event integration

added code to pass subscriptions to delay loaded components.