src/navigation.js
function replaceDocument(doc, docToReplace) {
    if (!(doc instanceof Document) || !(docToReplace instanceof Document)) {
        console.warn('Cannot replace document.');
        return;
    }
    navigationDocument.replaceDocument(doc, docToReplace);
}
function replaceDocument(doc, docToReplace) {
    if (!(doc instanceof Document) || !(docToReplace instanceof Document)) {
        console.warn('Cannot replace document.');
        return;
    }
    navigationDocument.replaceDocument(doc, docToReplace);
}
function replaceDocument ( doc , docToReplace ) { if ( ! ( doc instanceof Document ) || ! ( docToReplace instanceof Document ) ) { console . warn ( 'Cannot replace document.' ) ; return ; } navigationDocument . replaceDocument ( doc , docToReplace ) ; }
Replaces a document on the navigation stack with the provided new document.
Also adds the page level default handlers to the new document and removes the existing handlers from the document that is to be replaced.

@inner
@alias module:navigation.replaceDocument

@param  {Document} doc               The document to push
@param  {Document} docToReplace      The document to replace
Replaces a document on the navigation stack with the provided new document . Also adds the page level default handlers to the new document and removes the existing handlers from the document that is to be replaced .