Skip to content

[WIP] added connected callback#2

Open
ChrisBAshton wants to merge 1 commit intobbc:masterfrom
ChrisBAshton:connected_callback
Open

[WIP] added connected callback#2
ChrisBAshton wants to merge 1 commit intobbc:masterfrom
ChrisBAshton:connected_callback

Conversation

@ChrisBAshton
Copy link

@ChrisBAshton ChrisBAshton commented Jul 23, 2016

Opened a PR from my pym.js fork of this one.

DO NOT MERGE yet - await the outcome of https://github.com/bbc/news-vj-developer-scaffold-iframe-wrapper/pull/30.

Pym.js

BBC-specific modifications

  • We added the ability to init a pym Parent with a sourcedoc attribute rather than an iFrame URL.
  • We added a way of accessing host information:
  1. When creating pym Parent, pass a config property with whatever you like (e.g. host URL, cookies, etc)
  2. When creating pym Child, pass a connectedCallback function, which is invoked once a connection has been made with the pym Parent.
  3. Anything inside the callback can safely call pym Child.getHostInformation() - this provides a nice easy way for pym Childs to access host information.

Example:

var myConf = {
    hostInformation: {
        onBbcDomain: true,
        category:    'news'
    },
    applicationHtml: coreContentContainer.innerHTML
};
var pymParent = new pym.Parent(iframeUid, iframeUrl, {config: myConf});

...and the child:

new pym.Child({
    polling: 100,
    connectedCallback: function downloadApplication(self) {
        console.log(self.getHostInformation().hostInformation);
    }
});

i.e. added a way of auto-passing information from the host to the child
@ChrisBAshton ChrisBAshton changed the title added connected callback [WIP] added connected callback Jul 23, 2016
EdwardLuke pushed a commit that referenced this pull request Feb 15, 2018
…embedded_or_not

Put a class on html for whether the child is embedded, or not
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments