Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Ilya Bylich
@iliabylich
I guess it does handle
def m
  %x{
    1 + 1
  }
end
Simon George
@sfcgeorge
I'd assume there's a strip somewhere
Ilya Bylich
@iliabylich
That's an AST, not a string with the source code
Simon George
@sfcgeorge
Yeah, an AST usually doesn't have whitespace in
Jan Biedermann
@janbiedermann
but thats a ruby ast, where the inline js is just a string
or many strings
interrupted by ruby ast, if you js #{ ruby } more js
and the problem is exactly there, to understand js without parsing it :(
Simon George
@sfcgeorge
If the JS is just a string then surely you can strip it, so that wouldn't mistakenly be treated as multiline.
Jan Biedermann
@janbiedermann
and the ruby ast in between?
so its still ast nodes, of type :str, containing partial js
thats a :str
oh, ok, so for this case:
`$(#{selector})`
there is a tree :xstr with children:
:str (first part of js) :begin (ruby ast) :str (last part of js)
that are :strs
Jan Biedermann
@janbiedermann
so the 'mulitline' her is not the whitespace in the :strbut multiple :str, was, now with above fix, to look in the :str for a \nmulitline js is detected.
But @sfcgeorge you have a point, as minified js is minified to one line strings with no whitespace, but how would that stripping of whitespace benefit the situation here?
Mitch VanDuyn
@catmando
@/all question just came up... there is a Promise.when which could be called Promise.when_all, so why is there not a Promise.when_any?
G. Gibson
@mistergibson
So, is it impossilbe to work with a string that is ASCII8BIT ?
G. Gibson
@mistergibson
oh - got it - nevermind
G. Gibson
@mistergibson
Does anyone know of some example code for working with Buffer class?
Jamie Gaskins
@jgaskins
@catmando Bowser has a PR open for an implementation of ES6-style promises including Promise.race, which sounds like what you're looking for clearwater-rb/bowser#9
I just rewrote it a few weeks ago and rebased, so it's not actually an 18-month-old implementation I just haven't merged yet. :-) I've been considering merging it for a long time, but it removes all of Bowser's use of Opal's Promise implementation in favor of an API closer to what newer browsers offer natively, which is kinda scary.
Jan Biedermann
@janbiedermann
@elia @iliabylich and everybody else working on opal, opal 0.11 is a blessing! Its a giant step forward to ruby on the client! Its just amazing what bugs i find in existing 0.10 code and do keep wondering, "How did this ever work at all?"
I am amzed, fantastic :+1: :+1: :+1: :smile:
Elia Schito
@elia
@janbiedermann :smile: printed and framed! :laughing:
G. Gibson
@mistergibson
@elia : even though I've been into Opal a short time, I can second that sentiment. Opal is truly amazing and it has taken me in a whole new direction.
Elia Schito
@elia
@mistergibson I should add a "praise" section to the home page :smile:
G. Gibson
@mistergibson
lol, yeah
Billy.Zheng
@zw963
Thank @elia a lot for wonderful Opal. Hope see Opal 1.0 is released in the future.
G. Gibson
@mistergibson
Question: can I call a ruby object from js directly? example: @timer_handle = 'setInterval(#{self}.tick(),2000)' ... ?
Simon George
@sfcgeorge
Yes :)
do_later = $$[:setTimeout] # Accessing the "setTimeout" property
do_later.call(->{ puts :hello}, 2000)
do_later.call(->{ tick }, 2000)
do_later.call(method(:tick), 2000) # maybe
G. Gibson
@mistergibson
Sweet , thanks :)
ok, but not the way I expressed it in my question right?
Simon George
@sfcgeorge
G. Gibson
@mistergibson
Excellent, and much simpler than I thought it was - thanks again :)
Simon George
@sfcgeorge
That's from Ruby calling a JS function. If you mean from JS calling a Ruby function then no I don't think so. But you can do from Ruby inline JS calling Ruby
`setTimeout(#{method(:tick).to_proc}, 500)`
Note the backticks
G. Gibson
@mistergibson
ok, sure - that's cool
G. Gibson
@mistergibson
That all seems very straight forward. at first I was just unsure about HOW to refer to an object/method with respect to the native call. Thanks for clarifying.
Elia Schito
@elia

Thank @elia a lot for wonderful Opal. Hope see Opal 1.0 is released in the future.

@zw963 Thanks! The plan is to have the next major release be 1.0

Forrest Chang
@fkchang
what versions of opal are people running, esp. in production?
G. Gibson
@mistergibson
@fkchang : I use a github pull for mine
Elia Schito
@elia
@fkchang we're still on 0.10 but have a branch almost ready for 0.11
Forrest Chang
@fkchang
@elia thanks, I want to update (long over due) opal-console handling compatibility between different opal versions is rather difficult our production app is 0.8 don't want to strand too many people, but want to move towards supporting 0.11
Colin Gunn
@balmoral
@fkchang in production on 0.11
Mitch VanDuyn
@catmando
@fkchang as I think u know hyperloop is dropping support for opal < 0.11 .
@adamcreekroad is getting catprint up on latest hyperloop and opal. No issues so far
G. Gibson
@mistergibson
I notice a lot of people went with React
What is the best (most comprehensive) UI framework out there?
Your opinions please :)