These are chat archives for opal/opal

23rd
Jul 2015
meh.
@meh
Jul 23 2015 00:58
catmando, is the new Array still an Array?
catmando, it may be a double inclusion of the runtime somewhere
meh.
@meh
Jul 23 2015 01:21
@catmando ^
Mitch VanDuyn
@catmando
Jul 23 2015 01:22
Yeah in debugger original array is like object 16 new array is 150
I am not getting any double inclusion warnings
Mitch VanDuyn
@catmando
Jul 23 2015 01:37
  array_class = Array
  an_array = [1, 2, 3]
  another_array = array_class.new(3)  # <- works fine
  puts "[#{another_array}]"

  include React::Component

  array_class = Array
  an_array = [1, 2, 3]
  another_array = array_class.new(3) # <- fails!  says 3 is not native!!!
  puts "[#{another_array}]"
Mitch VanDuyn
@catmando
Jul 23 2015 01:50
FYI same problem back in opal 0.7 and
Mitch VanDuyn
@catmando
Jul 23 2015 02:29
Found it: Not sure why but the gem is including Native from within a module. That seems to be causing the problem (makes sense)
Christian Käser
@dfyx
Jul 23 2015 13:23
@meh I'd like to +1 catmando's question about source maps.
It would be great if the source maps were split by their original file location (assets/vendor/gems)
meh.
@meh
Jul 23 2015 13:24
dfyx, elia is the sourcemaps guy
Christian Käser
@dfyx
Jul 23 2015 13:25
@elia see above ;)
meh.
@meh
Jul 23 2015 13:25
dfyx, I don't even use sourcemaps because I'm used to the compiled output :P
Elia Schito
@elia
Jul 23 2015 13:25
yeh
I was thinking of adding a black box kind of feature, where you can specify certain file paths that will be compiled to single file and not splitted and will be without sourcemaps
@dfyx @catmando that way the sourcemap is there only for the local app, I'm using a setup like this in rails and it's great
would that solve the problem?
Christian Käser
@dfyx
Jul 23 2015 13:29
@elia I think having the source maps in a logical directory structure would be a great way to start
Mitch VanDuyn
@catmando
Jul 23 2015 13:29
@elia - great idea
Elia Schito
@elia
Jul 23 2015 13:29
@dfyx can you give me an example of what it should look like?
Christian Käser
@dfyx
Jul 23 2015 13:30
Currently my own files and for example opal's math.rb are placed in the same directory
Mitch VanDuyn
@catmando
Jul 23 2015 13:32
it would be nice if it could be automagic. so if the gem was local you got the source maps, but if remote you didn't. Not sure how we could tell, but perhaps it could be just based on the the directory that the gem was in?
Christian Käser
@dfyx
Jul 23 2015 13:32

Now:

__OPAL_SOURCE_MAPS__
* application.rb
* myfile.rb
* native.rb
* ... other opal stuff

Better:

app/assets
* application.rb
* myfile.rb

gems
* ...

opal
* native.rb
* ...

vendor/assets
* ...
Something like that
Elia Schito
@elia
Jul 23 2015 13:38
@dfyx not easy given the current architecture
@catmando actually that's a good idea, chime in here opal/opal-rails#51 if you want
hoped to have some feedback before rolling that out for everyone
meh.
@meh
Jul 23 2015 14:00
lol
Elia Schito
@elia
Jul 23 2015 14:00
:D
Vais Salikhov
@vais
Jul 23 2015 14:00
At some point you just don't need sourcemaps anymore :wink2:
Elia Schito
@elia
Jul 23 2015 14:01
you see the woman in red?
Andrew Kalek
@anlek
Jul 23 2015 16:13
Hey, Is it possible to use Opal in a something like phone gap?
Elia Schito
@elia
Jul 23 2015 16:13
I know @adambeynon used it in all sorts of configurations with mobile phones (phonegap/webview/etc.)
Andrew Kalek
@anlek
Jul 23 2015 16:14
Nice!
Forrest Chang
@fkchang
Jul 23 2015 21:12

@adambeynon @elia @meh or anyone else, any idea why

function require_js_sync(url) {
    var r = new XMLHttpRequest();

    r.open("GET", url, false);
    r.send('');
    eval(r.responseText);
}
require_js(sync 'https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.4/raphael-min.js')

works fine in the js console (only tried chrome)
yet

def require_js_sync(url)
  %x|
     var r = new XMLHttpRequest();
     r.open("GET", url, false);
     r.send('');
     eval(r.responseText)
  |
  nil
end
require_js_sync 'https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.4/raphael-min.js'

fails with 'TypeError: b.on is not a function' ?

Elia Schito
@elia
Jul 23 2015 22:14
@fkchang maybe it has to do with the context of eval
but a check with the debugger about what b is should help more :)