garris / TremulaJS

TremulaJS: Picture Streams + Momentum Engine + Bézier Paths + Multi-Device

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor this please

vko-online opened this issue · comments

Sorry but code is a bit messy, tried to make angular version - didn't succeed, no errors, it's just not building component. Angular version can be easily done, that's just too large, and can't be done until refactor, also it was written with AMD in mind. Or at least try to make angular version yourself. For now, here's fork with angular version. [not working]

Hi @vko-online. I think there is an easier approach. You could use the already built version of tremulajs and simply call that from a custom angular directive (you would create the custom directive). The directive would initialize an instance of tremulajs, binding it to the directive element and perhaps managing data source bindings. Your template might look something like this...

<tremula data-feed="someDataFeed"></tremula>

...where someDataFeed might be an iterator object or data service that returns data when it is available.

Alternatively, you could pass a controller object which would handle two way communication, pushing data to TremulaJS based on other app events (for example: user changes a filter) or TremulaJS pulling a new page of data (for example: when users scrolls to the end of a stream).

But in any case, I don't think there is any reason to actually refactor the component the way you seem to be thinking.