Please look into using the standard tools provided before taking this step.
Already there is the ability to do the following:
1. State Based defintions
2. Visibility of Widgets
3. Swapping of contained mashups
with those three abilities, you should be able to cover a host of scenarios, perhaps if you post a description of what you are looking to do, people might be able to share how they do it with standard Thingworx widgets, before exploring customization..
They can leverage the Expression widget, they can also create their own custom widgets.
Mostly though client side we focus on visualization and the model drives the logic and behavior so generally that code is Server side, so those links are generated Server side and then passed back to the client side, instead of trying to generate those with JS client side.
Not sure if these are the same use cases.