DiscussMenu.share

Syntax

share (type: PP.Ui.ShareType, url, title)

Parameters

type. Social network to which a message is published. The PP.Ui.ShareType enumeration instance.

url. Link to the page to be published. By default the link refers to the current page.

title. Title for the published message.

Description

The share method publishes a link to specified page to a selected social network.

Example

To execute the example, the page must contain the DiscussMenu component named shareMenu (see Example of Creating the DiscussMenu Component). Add a button, clicking which publishes a message to LinkedIn:

    var but3 = new PP.Ui.Button(
    {
        Content: "Publish to LinkedIn",
        ParentNode: document.getElementById("btn3"),
        Click: function ()
        {
            shareMenu.setAutoShare(false);//on menu item selecting, there is no corresponding social network opened
            shareMenu.setTitle("My report");//Set title to published message
            shareMenu.setUrl("http://pp:8080/pp/app/dashboard.html");//set publish link             shareMenu.share(PP.Ui.ShareType.LinkedIn, shareMenu.getUrl(), shareMenu.getTitle());//publish         }     });

After executing the example clicking the menu items does not publish a message. On clicking the Publish to LinkedIn button, the link set for menu in the DiscussMenu.Url property value by the setUrl method is published. The published message title is My report.

See also:

DiscussMenu