These are chat archives for opal/opal

26th
May 2016
Mitch VanDuyn
@catmando
May 26 2016 01:30
@elia any clever way to conditionally require something that is in a gem
I tried
require 'sources/react' unless defined? NOREACTJS

and then previous to the require of the gem I did a

NOREACTJS = true

did not work... any other way to do this?

Jamie Gaskins
@jgaskins
May 26 2016 05:05
Conditional requires are awkward because a require is done at compile time. I think a workaround was tried, but I don't think it did well.
Bernhard Weichel
@bwl21
May 26 2016 11:42
Is the digest module available in opal?
Forrest Chang
@fkchang
May 26 2016 16:05
@jgaskins hmm, how about some kind of dynamic_require that goes back to the app's server and pulls the file as appropriate
Brady Wied
@wied03
May 26 2016 16:17
@jgaskins @elia - Maybe Travis isn't being honest about timing but some of these dup things would appear to have dramatically improved opal-rspec runtime. As in 13 min to 4 min. - https://travis-ci.org/opal/opal-rspec/builds/124591999
Brady Wied
@wied03
May 26 2016 16:31
@bwl21 - Not yet. the stdlibs that are there are @ https://github.com/opal/opal/tree/master/stdlib
Jamie Gaskins
@jgaskins
May 26 2016 23:03
@fkchang I've wondered about that, too, but making it work async is probably tricky.

For example, what would happen in this scenario:

dynamic_require 'foo'

f = Foo.new

Making dynamic_require work async would mean that the following line is most likely executed before the request returns. Making it work synchronously means it locks the UI. :-\

Forrest Chang
@fkchang
May 26 2016 23:55
@jgaskins
how about
dynamic_require 'foo' do
  f = Foo.new
end
then promisify it
still could have issues in sequencing, but at least some sort of way to wait for the load