fn new() -> Self {
        EventLoopInner {
            microtask_queue: RefCell::new(VecDeque::with_capacity(INITIAL_QUEUE_CAPACITY)),
            waker: js!(
                var callback = @{|| EventLoop.drain()};
                var wrapper = function() {
                    if (!callback.dropped) { callback() }
                };
                var nextTick;

                // Modern browsers can use `MutationObserver` which allows
                // us to schedule a micro-task without allocating a promise.
                // https://dom.spec.whatwg.org/#notify-mutation-observers
                if ( typeof MutationObserver === "function" ) {
                    var node = document.createTextNode( "0" );
                    var state = false;

                    new MutationObserver( wrapper ).observe( node, { characterData: true } );

                    nextTick = function() {
                        state = !state;
                        node.data = ( state ? "1" : "0" );
                    };

                // Node.js and other environments
                } else {
                    var promise = Promise.resolve( null );

                    nextTick = function() {
                        promise.then( wrapper );
                    };
                }

                nextTick.drop = function() {
                    callback.dropped = true;
                    callback.drop();
                };

                return nextTick;
            ).try_into().unwrap(),
            shrink_counter: Cell::new(0)
        }
    }
// Initializes the event loop. Only called once.
Initializes the event loop. Only called once.
Initializes the event loop . Only called once .
fn new() -> Self {
        EventLoopInner {
            microtask_queue: RefCell::new(VecDeque::with_capacity(INITIAL_QUEUE_CAPACITY)),
            waker: js!(
                var callback = @{|| EventLoop.drain()};
                var wrapper = function() {
                    if (!callback.dropped) { callback() }
                };
                var nextTick;
                // Modern browsers can use `MutationObserver` which allows
                // us to schedule a micro-task without allocating a promise.
                // https://dom.spec.whatwg.org/#notify-mutation-observers
                if ( typeof MutationObserver === "function" ) {
                    var node = document.createTextNode( "0" );
                    var state = false;
                    new MutationObserver( wrapper ).observe( node, { characterData: true } );
                    nextTick = function() {
                        state = !state;
                        node.data = ( state ? "1" : "0" );
                    };
                // Node.js and other environments
                } else {
                    var promise = Promise.resolve( null );
                    nextTick = function() {
                        promise.then( wrapper );
                    };
                }
                nextTick.drop = function() {
                    callback.dropped = true;
                    callback.drop();
                };
                return nextTick;
            ).try_into().unwrap(),
            shrink_counter: Cell::new(0)
        }
    }
fn new ( ) -> Self { EventLoopInner { microtask_queue : RefCell :: new ( VecDeque :: with_capacity ( INITIAL_QUEUE_CAPACITY ) ) , waker : js ! ( var callback { EventLoop drain ( ) } var wrapper function ( ) { if ( callback dropped ) { callback ( ) } } var nextTick // Modern browsers can use `MutationObserver` which allows // us to schedule a micro-task without allocating a promise. // https://dom.spec.whatwg.org/#notify-mutation-observers if ( typeof MutationObserver " " ) { var node document createTextNode ( " " ) var state false new MutationObserver ( wrapper ) observe ( node { characterData true } ) nextTick function ( ) { state state node data ( state " " " " ) } // Node.js and other environments } else { var promise Promise resolve ( null ) nextTick function ( ) { promise then ( wrapper ) } } nextTick drop function ( ) { callback dropped true callback drop ( ) } return nextTick ) . try_into ( ) . unwrap ( ) , shrink_counter : Cell :: new ( 0 ) } }
Initializes the event loop.
Initializes the event loop .