-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How might you call console.log? #226
Comments
@dherman, pretty please. |
I closed this thinking that I would be able to use the chakracore-rs library, but that didn't work out. I'm reopening this, hoping that I can get some help learning to use it. |
OK, the API that's missing is the ability to get to the current global object -- filed as #249. From there you can pull off the |
Fixed in #253: pub fn call_console_log(call: Call) -> JsResult<JsObject> {
let scope = call.scope;
let global = scope.global();
let console = global.get(scope, "console")?.check::<JsObject>()?;
let log = console.get(scope, "log")?.check::<JsFunction>()?;
let args: Vec<Handle<JsString>> = vec![JsString::new(scope, "hello world").unwrap()];
log.call(scope, console, args.into_iter())?;
// ...
} |
console
is a global object in Node.js. How would I get a reference to it, so that I could call the.log
function`?Background: I want to play with a the TypeScript library from Neon, but need help getting started with Neon.
The text was updated successfully, but these errors were encountered: