These are chat archives for opal/opal

9th
Jul 2015
Christian Käser
@dfyx
Jul 09 2015 08:23
@fkchang yeah, Raphael works great with opal
I use it in my project to generate some pie charts
Forrest Chang
@fkchang
Jul 09 2015 16:39
@meh @elia @adambeynon I'm thinking perhaps the time to use toll free bridging is when you are passing back your objects to js. W/toll free bridging, you extend the js prototype, so the object you actually pass around is the js one. W/ include Native, you wrap the object and it's @native that is the actual js object, so passing the wrapper back to the original js isn't as seemless
Forrest Chang
@fkchang
Jul 09 2015 17:09
In my mucking w/Raphael and opal, I haven't needed to pass my object back to raphael, so it seems fine to just wrap it w/native, but I can imagine other js libs where you have objects, and you have to pass them back to the js libs a lot more in normal, where toll free bridging allows the actual js object get passed back vs. an opal wrapper obj that you have to expose the @native object back to js
Forrest Chang
@fkchang
Jul 09 2015 17:42
@all, wanted to pimp out the rspec part of opal-playground (which @adambeynon wrote). I've been using it w/a coworker to debate over how a spec should work
Forrest Chang
@fkchang
Jul 09 2015 17:47
Pretty damn handy for real life dev
Torsten Rüger
@rubydesign
Jul 09 2015 19:09
@fkchang i homed in on pixi, which i find the more complete package while still small-ish.
It just got a makeover with native, which i took to the extreme (just trying around) as you can see eg https://github.com/orbitalimpact/opal-pixi/blob/master/lib/opal/pixi/sprite.rb
It seems to unrap "ruby" objects and there is a possibility with the :as option to wrap the result. It's very smooth i think
The "on" method even knows how to handle a block (and i assume pass it as a js function).
The only js left is in the constructor and any code to make the library "smarter"
Forrest Chang
@fkchang
Jul 09 2015 21:29
@dancinglightning cool, I've been thinking that a reason to use toll free bridging is when you need to pass your objects back to the original js a lot. I haven't hit it in Raphael (not that I've worked that much), so I don't see it needed there, but I have 0 experience w/pixi to know if that makes sense. I think it makes sense in opal-jquery that Element is toll free bridged, coz you pass your elements to other jquery functions often.
Gabriel Rios
@gabrielrios
Jul 09 2015 22:12
@fkchang Yes, so I think that while using the library you won't have much need to pass the original JS back (if the library is completely wrapped), it would only make sense for interacting with JS libraries that don't have an Opal counterpart, so yes opal-jquery Element makes a lot of sense as there's tons of jquery plugins out there.