Comments (2)
This doesn't seem to be an issue with Javy; it's related to your code:
The input.json
that you're using will get encoded as a JavaScript object:
var num = {
num: 10
}
which you'll receive as a param in your main function. And the reason why you're getting 0
is because in JS comparing an object with a number (at least in this case) will always yield false. To make this work you need to access the actual number in the object param via num.num
. Another option is just changing the input file to
10
which is valid json.
It's important to remember that the output will be messagepack encoded, so you'll need to decoded it with a tool like msgpack2json
:
json2msgpack -i input.json | wasmtime run index.wasm | msgpack2json
from javy.
@saulecabrera Thanks a lot for your time and Clarification
It's working flawlessly now
Closing the issue as well :)
from javy.
Related Issues (20)
- Avenues for rich host functions HOT 7
- Feature Request: Ability to Change Brotli Compression Level via CLI HOT 3
- Stop using cargo-wasi
- Support a WASI reactor target HOT 3
- Where can a dynamically linked WASM run? HOT 3
- Can javy receive command line args / env. Are they in scope? HOT 10
- Can't build javy main branch on Ubuntu 23.10 HOT 10
- imports HOT 6
- Imported functionallity from the host HOT 2
- Expose Rust structs to JavaScript as classes HOT 8
- [quickjs-wasm-sys] `JS_DupValue` is missing HOT 3
- [quickjs-wasm-rs] Should the closure passed to `wrap_callback` return `JSValueRef`? HOT 3
- Urgent help required : How to debug this ? Getting error at some line no in function.mjs HOT 6
- How to use Javy with asynchronous JavaScript code? (experimental_event_loop) HOT 5
- Errors in async top-level functions do not result in traps HOT 1
- Allow specifying which file descriptor is used in console.{log,err} from the CLI HOT 2
- accessing arguments.callee leads to TypeError: invalid property access HOT 2
- Serialize function / callbacks with enclosing context; HOT 4
- Example running using Node.js as a host HOT 14
- Implement Cancellable or interruptible setTimeout in javy HOT 5
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 javy.