Replies: 10 comments
-
You already can call JS function from V in fn JS.Math.tan(f64) f64
fn tan(x f64) f64 {
return f64(JS.Math.tan(x)) // do not forget to wrap return value in `f64` again, atm js gen does not do this automatically
}
|
Beta Was this translation helpful? Give feedback.
-
fn JS.Math.tan(f64) f64
fn JS.console.log(string)
fn tan(x f64) f64 {
return f64(JS.Math.tan(x)) // do not forget to wrap return value in `f64` again, atm js gen does not do this automatically
}
JS.console.log("hello from js!") don't work,I'm viewing generated js file and in this file have only this prototype VV_LOCAL_SYMBOL void main__main(void) {
JS__console__log(_SLIT("hello drom js!"));
}
VV_LOCAL_SYMBOL void JS__console__log(string ); there is some source for calling js from vlang, or what pieces of code you can read in the vlang compiler? |
Beta Was this translation helpful? Give feedback.
-
@sh4m2hwz you have to compile with
|
Beta Was this translation helpful? Give feedback.
-
using the -b option nodejs will not generate console.log ("hello from js!") |
Beta Was this translation helpful? Give feedback.
-
what do you mean?
|
Beta Was this translation helpful? Give feedback.
-
@playXE |
Beta Was this translation helpful? Give feedback.
-
@KeitoTobi1 yes! Atm I work with NodeJS mainly because it has all its modules enabled by default. AFAIK Deno requires passing CLI arguments to enable IO for example |
Beta Was this translation helpful? Give feedback.
-
How to use V to call js functions like python |
Beta Was this translation helpful? Give feedback.
-
execjs Is this waiting for a third-party library to implement the function of calling js? |
Beta Was this translation helpful? Give feedback.
-
We hope that Vlang can directly call JavaScript functions, if supported. I hope to provide a more mature case here |
Beta Was this translation helpful? Give feedback.
-
Maybe call js code browser or nodejs from v code?
if not, support is planned in this direction?
Beta Was this translation helpful? Give feedback.
All reactions