meh` changed the topic of #opal to: http://opalrb.org - Ruby runtime and library on top of Javascript | 1.0.0 is near | This channel is logged at https://botbot.me/freenode/opal/
elia has quit [Quit: Computer has gone to sleep.]
f-3r has quit [Ping timeout: 244 seconds]
f-3r has joined #opal
f-3r has quit [Client Quit]
f-3r has joined #opal
e_dub has joined #opal
fkchang has quit [Ping timeout: 246 seconds]
harrow has quit [Ping timeout: 245 seconds]
harrow has joined #opal
f-3r has quit [Read error: Connection reset by peer]
f-3r has joined #opal
f-3r has quit [Client Quit]
greenride has joined #opal
godd2 has joined #opal
meh` has quit [Ping timeout: 245 seconds]
greenride has left #opal [#opal]
e_dub has quit [Quit: e_dub]
godd2 has quit [Remote host closed the connection]
elia has joined #opal
e_dub has joined #opal
e_dub has quit [Client Quit]
e_dub has joined #opal
elia has quit [Quit: Computer has gone to sleep.]
boberetezeke has joined #opal
elia has joined #opal
elia has quit [Client Quit]
GitHub84 has joined #opal
<GitHub84> [opal] elia pushed 8 new commits to master: http://git.io/pNpU
<GitHub84> opal/master 0c064c3 Vais Salikhov: Remove vestigial fail lines from spec/filters/bugs/string
<GitHub84> opal/master f8f28fa Vais Salikhov: Moved "String#index raises a TypeError if passed a Symbol" to unsupported
<GitHub84> opal/master 35cc4fc Vais Salikhov: Pass "String#to_str returns a new instance of String when called on a subclass"
GitHub84 has left #opal [#opal]
travis-ci has joined #opal
<travis-ci> opal/opal#2377 (master - 8ac056e : Elia Schito): The build passed.
travis-ci has left #opal [#opal]
boberetezeke has quit [Ping timeout: 245 seconds]
elia has joined #opal
elia has quit [Quit: Computer has gone to sleep.]
meh` has joined #opal
DrShoggoth has quit [Quit: Leaving]
lulzmachine has joined #opal
<lulzmachine> Hey… is Opal in use a lot? Wndering whether to take the plunge or not
TheKingOfPoon has joined #opal
<TheKingOfPoon> yo
<meh`> lulzmachine, depends on your idea of a lot
TheKingOfPoon has left #opal [#opal]
<lulzmachine> well just about enough to give a sort of nuanced indication of what the issues are with using Opal :p
<meh`> many gems work unmodified
<meh`> as long as you know what cannot be supported and other limitations given by javascript you're good to go
<lulzmachine> alright
<meh`> rspec works unmodified
<lulzmachine> does it get heavy quickly? I mean with the overhead of the runtime and the differences between the compiled code and equivalent javascript code
<meh`> depends on the kind of code you're writing
<meh`> if it's mostly web stuff, like dom changing and whatnot there's no relevant overhead
<meh`> if you're doing math heavy stuff you'll feel the overhead to some extent
<meh`> but you can always write inline javascript for those cases and optimize
<lulzmachine> alright
<lulzmachine> I’ll mostly be dom fiddling. it won’t be cpu heavy stuff, but maybe some data shuffling
<lulzmachine> the idea is to build a chat site, you could say similar to IRC
<meh`> then you won't incurr in any perceptible overhead
<lulzmachine> and right now I’m thinking of letting the user switch between chat rooms on the client, instead of as today, with a server round-trip
<lulzmachine> hm yeah alright
<lulzmachine> do you know how big the runtime is? I’m just thinking download times
<meh`> I don't remember, I think it was something around 40 or 80KB minimized and compressed?
<lulzmachine> sounds good
<lulzmachine> are u using it with rails meh` ?
<meh`> lulzmachine, nope
<lulzmachine> alright
<meh`> but everyone else does
<lulzmachine> how do u typically do templating?
<lulzmachine> guess i need a strategy to be able to draw templates on server and client side
<meh`> I don't, I use this https://github.com/meh/lissio
<meh`> and write a REST backend in whatever
<meh`> lulzmachine, I think adambeynon was working on something like that? but I may be recalling wrong
<lulzmachine> oh right, yeah i saw something in that opal talk about that
<lulzmachine> looks like a cool idea
<adambeynon> lulzmachine: the opal gem has built in support for ERB compiling, and the opal-haml gem supports the same for HAML
<adambeynon> I use haml exclusively in each project
<adambeynon> there is also opal-slim, if thats your thing
<lulzmachine> oh rly… thought I’d have to do jst+ejs, and then try to persuade the server to also render the ejs
<adambeynon> nope! :D
<adambeynon> I share a lot of haml views between rails and opal
<adambeynon> also, I have pushed some fixes in the last couple of days to be able to support passing local variables to templates
<adambeynon> which was missing
<adambeynon> performance wise, it works great - just creates an array, pushes a load of strings, and calls join
<adambeynon> very similar to js style templating
<adambeynon> it gets even nicer when I share view helpers between client and server as well - lots of date + currency formatters
<adambeynon> and as meh` says, with rspec working, I can share tests between both setups as well
<lulzmachine> i was just wondering about the view helpers
<lulzmachine> how do they appear on the client? :o
<adambeynon> lulzmachine: you can add any directory into the opal load path, so I tend to share my app/helpers, app/views etc, and then pick and choose individal files to compile into opal. as they are just modules, I then include them into the relevant Vienna::View subclass
<adambeynon> we cant use as much magic as rails, i.e. auto loading everything by name, but if you dont mind a few `require()` statements then you are good to go
<lulzmachine> oh okay
<lulzmachine> yeah sounds good
<lulzmachine> think ill stay away from vienna for now though
<lulzmachine> we’ll see how it turns out
<lulzmachine> thanks for the help though
<adambeynon>
DrShoggoth has joined #opal
<lulzmachine> is it possible to register a method to be runnable from a js context?
<lulzmachine> I imagined initializing the script from a normal index.erb like this: http://pastebin.com/wvGS2XTe
<lulzmachine> where doit() would be my startup method
<meh`> lulzmachine, I'm not sure I understand how you mean
<lulzmachine> alright. So say I want to have a client side app. First I want to feed it with data (in the form of a javascript variable?), and then tell the script to start running. How can I tell it to start from a regular javascript context? Or am I thinking this backwards
<meh`> lulzmachine, it feels kind of backwards, wouldn't it be better to have a RESTy call that fetches those variables?
<meh`> lulzmachine, I mean, you can make it work like that
<lulzmachine> saves a round-trip bro :p
<lulzmachine> but yeah, then I could do things a bit more easily
<lulzmachine> so you don’t typically give the javascript ANY state before it runs?
<meh`> never done it that way
<lulzmachine> adambeynon: i managed to connect opal and a template together now
<lulzmachine> using .erb templates
<lulzmachine> but I get ReferenceError “asdf” is not defined
<lulzmachine> so I think it thinks my .erb file is already-compiled javascript, as opposed to the html-like string it is
<lulzmachine> is that expected?
elia has joined #opal