Here are some thoughts I am having for this Extension and others to follow:
Features per Extension
I cleaned up the public interface (upcoming release to only two commands). Less is more and less to maintain and support. Also rather have something that just does the job then offer a million features.
Mountingpoint
I am still thinking about the mounting point. I currently have the part facing HTML in window['LB']
that allows to trigger functions specific to the extension from the page scope. This allows for a very short notation LB.triggerCustomBehaviour('RedAlert')
but means if every Extension does this it rather quickly pollutes window
. One could collect them in window['Extension']
. For this case resulting in window['Extension']['LocalConnection']
producing the command path Extension.LocalConnetion.triggerCustomBehaviour('RedAlert')
. My other thought was going into window['HYPE']
. The later could mess with Hype itself so I am hesitant given Hype uses the following to init…
if (window['HYPE'] == null) {
window['HYPE'] = window['HYPE_584'];
window['HYPE']['documents'] = {};
}
… one could easyly break Hype through setting window['HYPE']
to not null to create window['HYPE']['LocalConnection']
. On the other hand one could just do the following in Extensions …
if (window['HYPE'] != null) {
/*init in here*/
window['HYPE']['ExtensionName'] = …
}
That would have the downside that Extensions depend on Hype being loaded first otherwise they break and are not initialized. Also not ideal… but the command path looks neat HYPE.LocalConnection.triggerCustomBehaviour('RedAlert')
Got any thoughts on the matter?