Comments (7)
Hey. How are you compiling the code (ruby tools? altjs.org?)? Also, can you paste the code that it is generating?
from opal.
I compile browser.rb with this command:
opal compile browser.rb > browser.js
I've updated my browser.js file: https://gist.github.com/1020856
Of course, I use opal edge version (git clone).
Thank you again. Great piece of work!
from opal.
Ooooops! I closed this issue by mistake!
from opal.
Ahhhhh, it seems that the compile
command misses out a little piece of code. Basically that outputted code should be inside a function which defines the $runtime
variable. I'll go fix that and update you here once its all working again.
from opal.
So I've just committed a fix for this at 102a979. You need to pull the latest changes, regenerate opal.js or opal.dev.js (either will do) and recompile your file with that same command you used before. The generated code is now properly wrapped and will be run directly. Let me know if this solves the issue.
from opal.
Great!
Now it works OK.
Opal rocks! Thank you!
from opal.
Glad Its working. Just as a follow up, I've just pushed b1f5a1f to master which adds some more build options to the compile
command. In your use case, it has the same effect except that the generated code will now be written directly to the output file which it assumes from your input filename, so the following should work for you:
bin/opal compile browser.rb
Which outputs the code to browser.js
.
from opal.
Related Issues (20)
- Bug: No backtrace on exceptions under Firefox HOT 6
- Feature: Opalfile
- Bug: Methods defined by `Module#define_method` with UnboundMethod do not accept a block
- Bug: jsid_cache breaks for `"toString"`, and I suspect other methods of JS Object HOT 6
- is it possible to require 'openssl' in opalrb? HOT 1
- is it possible to require 'openssl' in opalrb? HOT 1
- Bug: `def` + `define_method` + `return` cause `LocalJumpError` HOT 1
- Feature: mirror Opal only classes into CRuby
- Bug: define_method -> block -> return -- unexpected return
- Bug: String#strip differs in handling the NBSP character
- 1.8.2 release was not completed HOT 2
- Bug: `Hash#compare_by_identity` does not work with string keys
- Bug: Bad behaviour with combination of: StringScanner#scan, multiline regexp, multiple lines HOT 2
- Bug: String interpolation with bridged classes does not call `to_s` HOT 2
- Bug: Cannot run minitest on Ruby 3.3 HOT 1
- Feature: Date and DateTime classes from Ruby HOT 5
- Bug: `load` cannot be invoked on a path unless `require` has been called on it first
- Feature: `puts` & `p` can handle native JS objects not wrapped by `Native` for simple debugging/troubleshooting
- Rack, Roda, Sinatra and other framework compatibility (when running on Opal and Node or alternative)
- Feature: Interact with JS Object directly without having to manually wrap with Native HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opal.