I'm using Opal in my MeteorJS project.
I'm trying to figure out a way to do the Meteor.startup
code, but it doesn't seem to work..
I thought this would work:
require 'native'
@Meteor = `Meteor`
@Meteor.startup do
puts 'Go'
end
But it doesn't. The compiled code should be like the following:
Meteor.startup( function() {
console.log( "GO" );
} );
It's very regular to throw functions as parameters in JS, how would we do this in Opal?
The following should work fine:
require 'native'
@Meteor = Native(`Meteor`)
@Meteor.startup -> {
puts 'Go'
}
Note that using Native you pass a lambda instead of a block