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

add example of scheduling callback in class method #74

Open
amilajack opened this issue Jan 14, 2019 · 0 comments
Open

add example of scheduling callback in class method #74

amilajack opened this issue Jan 14, 2019 · 0 comments
Assignees

Comments

@amilajack
Copy link
Member

// --snip--
method poll(mut cx) {
  let cb = cx.argument::<JsFunction>(0)?;
  let this = cx.this();
  let events = cx.borrow(&this, |emitter| Arc::clone(&emitter.events));
  let emitter = EventEmitterTask(events);

  emitter.schedule(cb);

  Ok(JsUndefined::new().upcast())
}
// --snip--

Taken from neon-bindings/neon#386

@amilajack amilajack self-assigned this Jan 14, 2019
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

No branches or pull requests

1 participant