FAQ Database Discussion Community

Event Complete Callbacks with Opal-jQuery

I am working on a project that handles multiple jQuery events in succession using the opal-jquery wrapper. jQuery has very effective callback functionality and I am wondering if it is possible to do this in pure ruby with Opal.

Appending an element to a page in VoltRb

I'm trying to append an element to one of my pages in a Volt project, via opal-browser, like so: if RUBY_PLATFORM == 'opal' require 'browser' $document.body << my_dom_element.to_n end # controller code below Unfortunately, I'm getting an error: [Error] TypeError: null is not an object (evaluating 'value.nodeType') (anonymous function) (main.js,...

Opal.rb anonymous function in native object

Is it possible to somehow achieve methods/lambda assigned in Hash to compile to native functions in native object? for example let x = {foo: "foo", bar: ->{"bar"}} I need that x to be compiled like such native object: pseudo x.to_n => Object {foo: 'bar', bar: function(){return "bar";}} OK THAT WORKS...