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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -