Skip to main content

ensemble.SocialShare

ensemble#

ensemble~SocialShare ⇐ base#

ensemble.SocialShare component.

Kind: inner class of ensemble
Extends: base
Todo

  • arguments

new SocialShare([element], options)#

Constructor method.

ParamTypeDefaultDescription
[element]ElementA valid Element node that will be replaced with this component
optionsobjectOptions object
[options.ns]string"share"The namespace for social share
[options.root]string"body"The root Element node
[options.className]string | Array.<string>"social-share"The component CSS class name
[options.link]string"''"The link, leave empty to auto-discover with selector or location.href
[options.title]string"''"The title, leave empty to auto-discover with selector or window.title
[options.description]string"''"The description, leave empty to auto-discover with selector
[options.displays]objectnullActions to display, default to all
[options.intents]objectAction intents
[options.uriform]objectURI strings
[options.label]objectCustom parameters for label
[options.selectorLink]objectAn element selector to find link
[options.selectorTitle]objectAn element selector to find title
[options.selectorDescription]objectAn element selector to find description
[options.locale]objectLocalization
[options.onInit]functiononInit callback, fires when social share is initialized
[options.onIntent]functiononIntent callback, fires when an action is called

Example

new ensemble.SocialShare(document.getElementById('my-div-placeholder'), {});

socialShare._defaults() ⇒ object#

Options object default properties.

Kind: instance method of SocialShare

socialShare._bindings()#

Methods binding.

Kind: instance method of SocialShare

socialShare.generator()#

The generator creates almost everything the component needs and replaces the element placeholder.

Kind: instance method of SocialShare
Todo

  • dataset

socialShare.init()#

Initializes the component.

Kind: instance method of SocialShare
Todo

  • TODO

socialShare.populate()#

In this stage the component is populated with all the content progeny.

Kind: instance method of SocialShare
See: window.navigator.share()

socialShare.action(intent, title)#

Creates the whole set of buttons.

Kind: instance method of SocialShare
Todo

  • dataset
ParamTypeDescription
intentstringThe activity name
titlestringA title for activity

socialShare.intent(e, target)#

The intent activity. This method is called from each action.

Kind: instance method of SocialShare
See: window.location
Todo

  • url validation
ParamTypeDescription
eEventAn Event
targetElementThe element that is invoking

socialShare.text(data) ⇒ string#

Makes text substitutions and encodes to an URL

Kind: instance method of SocialShare
Returns: string - - The encoded URL text string

ParamTypeDescription
dataobjectThe data object
data.urlstringShared URL
data.titlestringShared title
data.textstringShared description text
data.summarystringShared summary

socialShare.social(e, data)#

Generic social method for social network sharing intent.

Kind: instance method of SocialShare
See: window.open()

ParamTypeDescription
eEventAn Event
dataobjectThe data object
data.urlstringShared URL
data.titlestringShared title
data.textstringShared description text
data.summarystringShared summary

socialShare.sendEmail(e, data)#

Send email intent, it tries to open the default mail client.

Kind: instance method of SocialShare
See: window.open()

ParamTypeDescription
eEventAn Event
dataobjectThe data object
data.urlstringShared URL
data.titlestringShared title
data.textstringShared description text
data.summarystringShared summary

socialShare.copyLink(e, data)#

Copy link intent, it tries to copy URL on the clipboard.

Kind: instance method of SocialShare
See

  • document.createElement()
  • document.execCommand()

Todo

  • TODO
ParamTypeDescription
eEventAn Event
dataobjectThe data object
data.urlstringShared URL
data.titlestringShared title
data.textstringShared description text
data.summarystringShared summary

socialShare.webShare()#

Calls the native WebShare API for sharing.

Kind: instance method of SocialShare
See: window.navigator.share()