/// JS Callback, returns a promise which is resolved into a peripheral event object.
/// arguments: (boolean/undefined): Whether to pull passively or not.
///
/// When in passive mode, the promise is resolved instantly either with an event from the queue,
/// or with `null` if the queue is empty.
///
/// Otherwise in aggressive mode, the promise is not resolved until an event is pushed to the queue.
JS Callback, returns a promise which is resolved into a peripheral event object.
arguments: (boolean/undefined): Whether to pull passively or not.

When in passive mode, the promise is resolved instantly either with an event from the queue,
or with `null` if the queue is empty.

Otherwise in aggressive mode, the promise is not resolved until an event is pushed to the queue.
JS Callback returns a promise which is resolved into a peripheral event object . arguments : ( boolean / undefined ) : Whether to pull passively or not . When in passive mode the promise is resolved instantly either with an event from the queue or with ` null ` if the queue is empty . Otherwise in aggressive mode the promise is not resolved until an event is pushed to the queue .
fn pull_event_callback(scope: &mut HandleScope, args: FunctionCallbackArguments, mut rv: ReturnValue) {
        let promise_resolver = PromiseResolver::new(scope).unwrap();
        rv.set(promise_resolver.get_promise(scope).into());
        let passive = args.get(0).boolean_value(scope);
        let state_cell = Self::get(scope);
        let mut state = state_cell.borrow_mut();
        let event = state.events_queue.pop_front();
        if let Some(event) = event {
            let event_object = event.js_object(scope);
            promise_resolver.resolve(scope, event_object.into());
        } else if passive {
            let null = v8::null(scope);
            promise_resolver.resolve(scope, null.into());
        } else {
            let promise_resolver = Global::new(scope, promise_resolver);
            state.listening_promise.insert(promise_resolver);
        }
    }
fn pull_event_callback ( scope : & mut HandleScope , args : FunctionCallbackArguments , mut rv : ReturnValue ) { let promise_resolver = PromiseResolver :: new ( scope ) . unwrap ( ) ; rv . set ( promise_resolver . get_promise ( scope ) . into ( ) ) ; let passive = args . get ( 0 ) . boolean_value ( scope ) ; let state_cell = Self :: get ( scope ) ; let mut state = state_cell . borrow_mut ( ) ; let event = state . events_queue . pop_front ( ) ; if let Some ( event ) = event { let event_object = event . js_object ( scope ) ; promise_resolver . resolve ( scope , event_object . into ( ) ) ; } else if passive { let null = v8 :: null ( scope ) ; promise_resolver . resolve ( scope , null . into ( ) ) ; } else { let promise_resolver = Global :: new ( scope , promise_resolver ) ; state . listening_promise . insert ( promise_resolver ) ; } }
JS Callback, returns a promise which is resolved into a peripheral event object.
JS Callback returns a promise which is resolved into a peripheral event object .
scope
&mut HandleScope
args
FunctionCallbackArguments
rv
ReturnValue