These are chat archives for opal/opal

18th
Mar 2015
Adam Beynon
@adambeynon
Mar 18 2015 07:16
@elia morning! what issues? (I haven’t dived into the builder too much lately)
Elia Schito
@elia
Mar 18 2015 08:56
@adambeynon good morning! I always end up mixing and matching js coffee and opal, plus maybe erb etc.
also that would help in isolating sourcemaps per file, thus making them slower but more precise
@adambeynon that knowing that I could probably fix everything given enough time, which I don't have :smile_cat:
Adam Beynon
@adambeynon
Mar 18 2015 08:59
@elia time is the problem :D so, just to check, are you on about going back to a more standard sprockets based setup? and letting sprockets handle everything?
Elia Schito
@elia
Mar 18 2015 09:02
that's the idea, or let's say at least give chioce
it's surely easier than supporting every possible sprockets extension combination
would also be easier to understand for a sprockets user (con is the Opal.load part of course)
@adambeynon but for Opal.load I was thinking about overloading javascripts_include_tag to add Opal.load if Opal is defined and 'application' is a module
@adambeynon but I want to hear your opinion on this…
btw the source map fixing branch seem to work fine for serving them correctly, but the contents are still messed up
Adam Beynon
@adambeynon
Mar 18 2015 09:18
@elia for convenience, I think this is a good way to go. agreed with overriding the script tag as well. I do have some time tomorrow, so I can spend a couple of hours looking through the current code and seeing how things will pan out
Elia Schito
@elia
Mar 18 2015 09:18
@adambeynon thanks, I'll push my initial code to a branch then
I think this would also benefit caching, cc @ryanstout
Adam Beynon
@adambeynon
Mar 18 2015 09:19
:+1: yes, that’s true
@elia I went to the Bath Ruby conference on the weekend, and got some interesting feedback into people who have looked at opal before, and why/how the havent used it
it all comes down to some misconceptions about how it works
Elia Schito
@elia
Mar 18 2015 09:20
@adambeynon Also I think it can be done just in the processor without affecting the builder which can than be freed from some "sprockets" burden
Adam Beynon
@adambeynon
Mar 18 2015 09:20
so, I am going to focus some time clearing the docs up, to avoid this confusion
Elia Schito
@elia
Mar 18 2015 09:21
@adambeynon awesome™!
alas, marketing is fundamental, few will go beyond first impression and "discover reality"
@adambeynon so I saw a prev tweet of you mentioning stickers, ever printed any?
it's based on https://github.com/opal/opal/tree/elia/source-maps-fix, which is probably time to merge
Adam Beynon
@adambeynon
Mar 18 2015 10:05
@elia nope, not done any printing before
Elia Schito
@elia
Mar 18 2015 10:06
@adambeynon will be glad to send a bunch of them once they're viable (last batch was on paper instead of vinyl)
Adam Beynon
@adambeynon
Mar 18 2015 10:07
@elia sure! I will save some space on my new retina macbook for one ;)
Elia Schito
@elia
Mar 18 2015 10:08
:D
13 or 15?
Adam Beynon
@adambeynon
Mar 18 2015 10:08
@elia my move from cordova -> WKWebView was going really well until WebSQL seems to be broken on WKWebView
@elia noooo, the NEW one
12
ultra portablz
elia @elia drops jaw
Elia Schito
@elia
Mar 18 2015 10:09
yeah watched the whole preso, already shipped?
@adambeynon is it good for development
?
Adam Beynon
@adambeynon
Mar 18 2015 10:10
April 10th I think, need to pre-order it. Im hoping the processor is ok for dev. I still run various rails stuff on the original macbook air, and thats fine
Elia Schito
@elia
Mar 18 2015 10:10
btw I got a 15 at new workplace but really a fan of 13" (or less)
Adam Beynon
@adambeynon
Mar 18 2015 10:11
ah I didn’t realise you moved work. Still ruby dev?
Elia Schito
@elia
Mar 18 2015 10:11
ok, know confess the color of choice :)
yes, still ruby, and more opal (thankfully)
Adam Beynon
@adambeynon
Mar 18 2015 10:12
woop!
Elia Schito
@elia
Mar 18 2015 10:12
@adambeynon ever tried leveldb & co instead of sql? (I didn't)
Adam Beynon
@adambeynon
Mar 18 2015 10:12
Im not brave enough for gold, going for a classic apple silver colour I think
Elia Schito
@elia
Mar 18 2015 10:13
heh, yeah, gold is for tough guys only… (or not? not sure here lol)
Adam Beynon
@adambeynon
Mar 18 2015 12:26
@elia I have been using optimised math operators in my app now since 0.7, I think we should enable it by default as discussed before
seems pretty sturdy
Elia Schito
@elia
Mar 18 2015 12:57
:+1:
@adambeynon at this point I wonder if it still makes sense to stay on 0.7 instead of bumping version to 0.8…
enough stuff has been added already imo
Adam Beynon
@adambeynon
Mar 18 2015 13:00
@elia sounds good to me :ok_hand:
Elia Schito
@elia
Mar 18 2015 13:53
I'll push a 0-7-stable branch from the latest release, just in case
Adam Beynon
@adambeynon
Mar 18 2015 14:04
@elia okies. As we work on the changes for sprockets etc, I think it would be a good idea to keep checking opal-rspec works well with it. That is a huge pain with requires, so it might be easier than going back retrospectively to fix new issues
Elia Schito
@elia
Mar 18 2015 14:04
:+1:
Mitch VanDuyn
@catmando
Mar 18 2015 20:15
Quick question (I hope)... I have a gem that I want to "opal-ize". I have tested the gem by copying its files to the javascript directory, as well as the test specs, and all is well. Is there a trick I can use to reference the "master" gem inside the "opal" gem?
For now I am just copying the files over to the opal version, but long term obviously I don't want to do that!
Mitch VanDuyn
@catmando
Mar 18 2015 21:45
And actually if anybody wants to look, and see if did this right please do so:
It seems to work fine, but it also seems to be treating the files differently than the standard opal libraries. I am wondering if I am doing something wrong... I just stole the whole gem structure from opal-jquery...
Elia Schito
@elia
Mar 18 2015 22:15
@catmando struct seems right, you have any stacktrace or specific error?
Kurtis Rainbolt-Greene
@krainboltgreene
Mar 18 2015 22:27
Is there a good writeup on how to use third party js libraries inside opal?
Like, one function in javscript is function(FUNCTION, OPTIONS), but in Ruby that doesn't make sense as blocks are always the last argument..
And it doesn't seem to work in reverse.
Elia Schito
@elia
Mar 18 2015 22:30
nope, but basically you have two strategies: bridging js classes (as opal-jquery does) or wrapping with Native(jsObject)
Kurtis Rainbolt-Greene
@krainboltgreene
Mar 18 2015 22:34
I see writing about using expose with other jquery plugins, but nothing so far on handling common js practices.
Elia Schito
@elia
Mar 18 2015 22:34
Opal::Browser is a great example of using native
Kurtis Rainbolt-Greene
@krainboltgreene
Mar 18 2015 22:36
Yeah, I've been reading that.
Okay, the opal-jquery has details on how to do HTTP requests, which has a similar arity to what I'm dealing with, but it seems like instead of passing a hash with functions (mirroring the js Object with functions) it's got a block, and then has setter properties.
Hmm not setters.
Elia Schito
@elia
Mar 18 2015 22:47
@krainboltgreene try with the Element#animate source, probably a better example iirc
Kurtis Rainbolt-Greene
@krainboltgreene
Mar 18 2015 22:49
Gotta say, the internal documentation for these projects is top notch.
Looks like jquery.terminal is just doing things wrong.
But I can use #animate to do my own thing.
@elia: Is there a way to see the ruby source of a method generated via expose?
Elia Schito
@elia
Mar 18 2015 22:54
expose uses the js function as is
so, say the function returns undefined it could give trouble
Kurtis Rainbolt-Greene
@krainboltgreene
Mar 18 2015 22:59
Woot!
It had something to do with the fact that I was using a Ruby hash.
As soon as I used `` to generate a JS Object the options were recognized.
Kurtis Rainbolt-Greene
@krainboltgreene
Mar 18 2015 23:13
Are there any Ruby native object to Javascript native object methods?
AKA: `{ "key" => "value" }.to_native == ```{ "key": "value" }````
:|
Elia Schito
@elia
Mar 18 2015 23:15
require 'native' and #to_n
Kurtis Rainbolt-Greene
@krainboltgreene
Mar 18 2015 23:15
Awesome.
Thanks @elia.
Elia Schito
@elia
Mar 18 2015 23:25
glad to be helpful