Skip to content

How browserProvenance.js works

Kai Xu edited this page Jul 13, 2017 · 3 revisions

Video https://youtu.be/U5z8QMXG2yo

function onTabCreation(newTab) {
    addNode(newTab);
}

function onTabUpdate(tab) {
    
    if (url changed) { // 'loading' status in the 'changeInfo' object
        if (page finished loading) { // there was 'complete' status in the 'changeInfo' object before
            addNode(tab);
        }
        else { // page redirection
            update current node;
        }
    }

    if (title updated) {
        send the new title to history-map-page.js through an event;
    }
    
    if (favIconUrl updated) {
        send the new favIconUrl to history-map-page.js through an event;
    }
}

function addNode(tab) {
    create a new node with  the information from the 'tab' object;
    send the new 'node' to history-map-page.js through an event;
}
Clone this wiki locally