src/page-ready.js
function pageReadySetListeners(eventNames) {
        // Reset the previous state
        _store = {};
        _listeners.forEach(function(eventCallback) {
            ceddl.eventbus.off(eventCallback.name, eventCallback.markComplete);
        });
        _listeners = [];

        // If there is no need to wait for anything dispatch event when the page is ready.
        if (!eventNames || eventNames.length === 0) {
            pageReady(function() {
                ceddl.emitEvent('pageready', _store);
            });
            return;
        }

        startWarningTimeout();

        if (!Array.isArray(eventNames)) {
            // Split on whitespace and remove empty entries.
            eventNames = eventNames.split(' ').filter(function(value) {
                return !!value;
            });
        }

        if(_el) {
            _el.setAttribute('data-page-ready', eventNames.join(' '));
        }

        // Create the new state
        eventNames.forEach(function(name) {
            _store[name] = false;
        });
        _listeners = eventNames.map(setCompleteListener);
    }
function pageReadySetListeners(eventNames) {
        // Reset the previous state
        _store = {};
        _listeners.forEach(function(eventCallback) {
            ceddl.eventbus.off(eventCallback.name, eventCallback.markComplete);
        });
        _listeners = [];

        // If there is no need to wait for anything dispatch event when the page is ready.
        if (!eventNames || eventNames.length === 0) {
            pageReady(function() {
                ceddl.emitEvent('pageready', _store);
            });
            return;
        }

        startWarningTimeout();

        if (!Array.isArray(eventNames)) {
            // Split on whitespace and remove empty entries.
            eventNames = eventNames.split(' ').filter(function(value) {
                return !!value;
            });
        }

        if(_el) {
            _el.setAttribute('data-page-ready', eventNames.join(' '));
        }

        // Create the new state
        eventNames.forEach(function(name) {
            _store[name] = false;
        });
        _listeners = eventNames.map(setCompleteListener);
    }
function pageReadySetListeners ( eventNames ) { // Reset the previous state _store = { } ; _listeners . forEach ( function ( eventCallback ) { ceddl . eventbus . off ( eventCallback . name , eventCallback . markComplete ) ; } ) ; _listeners = [ ] ; // If there is no need to wait for anything dispatch event when the page is ready. if ( ! eventNames || eventNames . length === 0 ) { pageReady ( function ( ) { ceddl . emitEvent ( 'pageready' , _store ) ; } ) ; return ; } startWarningTimeout ( ) ; if ( ! Array . isArray ( eventNames ) ) { // Split on whitespace and remove empty entries. eventNames = eventNames . split ( ' ' ) . filter ( function ( value ) { return ! ! value ; } ) ; } if ( _el ) { _el . setAttribute ( 'data-page-ready' , eventNames . join ( ' ' ) ) ; } // Create the new state eventNames . forEach ( function ( name ) { _store [ name ] = false ; } ) ; _listeners = eventNames . map ( setCompleteListener ) ; }
Method to indicate when to fire the pageready event. It takes a collection
of event names and waits until all of them have fired at least once before
dispatching the pageready event.
Method to indicate when to fire the pageready event . It takes a collection of event names and waits until all of them have fired at least once before dispatching the pageready event .