wingify / across-tabs

Easy communication between cross-origin browser tabs. Simplified "CORS"ing!

Home Page:https://engineering.wingify.com/across-tabs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I get msg send by parent tab ?

KangdaOOLin opened this issue · comments

I check the api doc and I use the broadCastAll method to broadcast msg, but I can't get msg from child tab. Is there anything I have missed ?

// parent.html
// I can't get the msg send by child
parent.broadCastall(msg);

// child.html
// I also can't get the msg send by parent
child.sendMessageToParent(msg);

Check the example folder.
This file child.html registers a listener function onParentCommunication

var child = new AcrossTabs.Child({
	onReady: onReady,
	onInitialize: onInitialize,
        onParentCommunication: onParentCommunication
})

function onParentCommunication(dataReceived) {
	// do stuff with dataReceived from Parent
};

Similarly, Parent can receive messages using:

var parent = new AcrossTabs.Parent({
    onHandshakeCallback: onChildCommunication,
    onPollingCallback: showList,
    onChildDisconnect: onChildDisconnect
});

function onChildCommunication(data) {
    // `data` received from child
}

File to check: app.js

Hope, your issue is now resolved.
The issue should be closed now.

@softvar perfect ! Thank you for your wonderful answer