These are chat archives for opal/opal

15th
Aug 2015
Qqwy / Wiebe-Marten
@Qqwy
Aug 15 2015 05:23
@fkchang, @elia: All right, more details. I'm trying to make Opal interface with the JS library Phaser (phaser.io)
I was attempting to copy over this example to Opal code after calling Phaser = Native(\Phaser`)`
http://phaser.io/examples/v2/basics/02-click-on-an-image
To create a new game in Phaser, one calls the game = new Phaser.Game() method with some variables like screen size, but the last parameter is an JS Object containing the names of the functions that are to be called
1) preload: before the game is created
2) create: at the start of the game
3) update: Run once per frame (+-60x a second) afterwards.
As can be seen in the linked example, here they link to function names in the way that JS allows it, but when trying to move this code over to Opal, I get complaints that the functions cannot be executed. This is not strange as Ruby method calls don't need () behind them, whereas in JS the () are the difference between calling a function and passing a function.
Qqwy / Wiebe-Marten
@Qqwy
Aug 15 2015 05:29
I tried creating the create and preload functions (not messing with update at all yet) as procs with syntax like create = Proc.new do ...code here... end
but still Phaser would complain that the passed arguments could not be called as functions
Bernhard Weichel
@bwl21
Aug 15 2015 06:49

How can I get the methods / keys of a Native - object? I have the example in http://opalrb.org/try/?code:%0Aa%3D%25x%7B%0A%20%20%7B%22foo%22%3A%20%22bar%22%2C%20%22next%22%3A%20%22this%20is%20next%22%7D%0A%7D%0A%0Ab%20%3D%20Native(a)%0A%0Aputs%20b%5B%3Afoo%5D%0A%0Aputs%20b.keys%0Aputs%20b.methods%0A


a=%x{
  {"foo": "bar", "next": "this is next"}
}

b = Native(a)

puts b[:foo]

puts b.keys
puts b.methods

Background is, that I want to wrap a JS library (abc2svg) and need to clone the JS Objects.

Vais Salikhov
@vais
Aug 15 2015 06:50
@meh re your earlier request, please see opal/opal#1060 (it's a little disappointing, but we're moving in the right direction :wink: )
Bernhard Weichel
@bwl21
Aug 15 2015 07:24
@bbatsov thanks for the cool presentation
Torsten Rüger
@rubydesign
Aug 15 2015 08:32
@ryanstout when trying to get the hover to work on dom nodes i ran into voltrb/volt#266 , could you have a quick look if that is really a bug or me misunderstanding things.
Adam Jahn
@ajjahn
Aug 15 2015 17:32
This message was deleted

we are still on rails 3.2 .... i think that is problematic? I am getting
````
Bundler could not find compatible versions for gem "sprockets":
In snapshot (Gemfile.lock):
sprockets (2.2.3)

In Gemfile:
opal-rspec (>= 0) x86-mingw32 depends on
opal (< 0.9, >= 0.7.0) x86-mingw32 depends on
sprockets (~> 3.1) x86-mingw32

Running bundle update will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
````
Has there been any developments as far as using opal 0.8.0 with rails 3.2 due to the older version of sprockets? Or is rails 3.2 stuck with using opal 0.7.2?

George Plymale II
@ylluminarious
Aug 15 2015 21:39
@Qqwy if you're interested with working with phaser and opal, check out opal-phaser
Elia Schito
@elia
Aug 15 2015 21:44
@ajjahn alas you're right and for rails 3.2 you're stuck with 0.7
@ajjahn anything you needed in particular from 0.8? maybe we can do something either locally in your app or backporting fixes
Adam Jahn
@ajjahn
Aug 15 2015 21:48
@elia I haven't run into anything I need yet. I assume 0.7.2 will suffice. First time I've tried opal-rails on rails 3.2 app.
Elia Schito
@elia
Aug 15 2015 21:51
@ajjahn great, let me know if there's anything I can help with (the most unfortunate thing in 0.7 is that sourcemaps are kinda broken)
Adam Jahn
@ajjahn
Aug 15 2015 21:53
Yeah, I did notice that. I think I'll survive on this project without them. Thanks for you help.
Elia Schito
@elia
Aug 15 2015 21:53
:+1:
Qqwy / Wiebe-Marten
@Qqwy
Aug 15 2015 22:36

@ylluminarious : Wow, thanks a lot for pointing me there! And there I thought for a moment that the two wouldn't play nice together.

Thank you very much! :smile:

George Plymale II
@ylluminarious
Aug 15 2015 23:35
@Qqwy you're very welcome :). also, if you feel like chatting about it, you can use our gitter room.