voltrb - How do i implement a live clock? -
i have been playing round volt few days , love simple bindings allows. trying show 'live clock' on page using time.now. have tried binding time.now various collections within controller didn't quite work (i had refresh page new time show up, beating purpose). there way achieve without use of javascript?
right don't have bindings on time done yet. on todo list, @ moment you'll have manually update it. in lib file, require in controller `require '{component_name}/lib/{file}'
class time def live dep = volt::dependency.new dep.depend volt::timers.client_set_timeout(1000) dep.changed! end self end end
then in controller, can call .live on time instance instance of time class reactively update.
let me know if works. :-)
Comments
Post a Comment