Skip to content
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

Create an API for accessing the global object #249 #253

Merged
merged 2 commits into from
Oct 11, 2017
Merged

Create an API for accessing the global object #249 #253

merged 2 commits into from
Oct 11, 2017

Conversation

GabrielCastro
Copy link
Contributor

@GabrielCastro GabrielCastro commented Oct 8, 2017

I've implemented the api for getting a reference to the global object as per #249.
I've made it a method on scope such that the following works

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())?;
...

@dherman
Copy link
Collaborator

dherman commented Oct 11, 2017

@GabrielCastro Beautiful work! :D

@dherman
Copy link
Collaborator

dherman commented Oct 11, 2017

It looks like the Travis failure was a transient npm issue, and our appveyor config is busted right now, so I'm going to merge. (This is definitely not an acceptable state of affairs for the CI--we should get this fixed soon.)

@dherman dherman merged commit 09c5f28 into neon-bindings:master Oct 11, 2017
@GabrielCastro GabrielCastro deleted the implment-global-object-api branch October 11, 2017 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants