Origami Frontend Components & Services

JSDoc: o-comments

o-comments is not maintained by the Origami team. This means that the Origami team will not necessarily be able to help you with support requests. The people who maintain this component may be able to offer support, but it's not guaranteed.

new Count(countEl, opts)

Class constructor.

parameter type default description
countEl (optional) HTMLElement The component element in the DOM
opts (optional) object {} An options object for configuring the component

Methods

Links

new Stream(streamEl, opts)

Class constructor.

parameter type default description
streamEl (optional) HTMLElement The component element in the DOM
opts (optional) object {} An options object for configuring the component

Methods

Links

Comments.getDataAttributes(rootEl)

Static Method

Get the data attributes from the element. If the component is being set up declaratively, this method is used to extract the data attributes from the DOM.

parameter type default description
rootEl HTMLElement The component element in the DOM

Returns

  • object - - Data attributes as an object

Links

Comments.init(rootEl, opts)

Static Method

Initialise the component.

parameter type default description
rootEl HTMLElement | string The root element to intialise the component in, or a CSS selector for the root element
opts (optional) object {} An options object for configuring the component

Returns

  • Comments | Array.<Comments> - - Comments instance(s)

Links

Count.getCountLabel(count)

Static Method

Get the aria-label for the count element.

parameter type default description
count number The comment count

Returns

  • string - The string that should be used as the aria-label

Links

Stream#publishEvent(...)

Instance Method

Emits events that have a valid o-comment event name.

parameter type default description
args object The args object
args.name string The event name
args.data object The event payload

Returns

  • void

Links

Status
active
Switch component view

GitHub: o-comments@10.0.0

Install o-comments

If using the Build Service, add o-comments@^10.0.0 to your script and link tags.

If using the npm package manager for a Manual Build, run npm install --save-peer "@financial-times/o-comments@^10.0.0".

Help & Support

o-comments is not supported directly by the Origami team. We make no guarantees, but will help if we can. First try contacting its maintainers at:

Slack: #content-innovation
Email: content-innovation-team.customer-products@ft.com