Skip to content
This repository has been archived by the owner on Mar 23, 2020. It is now read-only.

Polymer (ES6) wrapper of Twitter Widget Library for Timelines

License

Notifications You must be signed in to change notification settings

LasaleFamine/polymer-twitter-timeline

Repository files navigation

<twitter-timeline> Polymer (ES6)

Build status Bower version JavaScript Style Guide Dependency Status

Wrapper of Twitter Widget.js as a customizable Polymer 1.0 WebComponent in ES6 syntax.

Why

<link rel="import" href="[your_bower_folder]/polymer-twitter-timeline/twitter-timeline.html">

<twitter-timeline data-widget-id="[yourId]"></twitter-timeline>

Forget to import any library, just import the component and polifylls if needed (webcomponentsjs just for Polymer) and you are ready to go.

Install

$ bower install polymer-twitter-timeline

Default Properties

{
  /** Twtt istance **/
  Twtt: {
    type: Function
  },
  uniqueId: {
    type: String,
    value: 'twitterTimelinePolymerLibLoader'
  },
  /**
   * Twitter data-id to feed the timeline
   * - Create a new widget: https://twitter.com/settings/widgets/new
   * - Get the data from whatever source you want
   * - Get the data-widget-id
   *
   */
  dataWidgetId: {
    type: String
  },
  /**
   * Specifies `width` and `height` of the widget
   *
   * @type {{width: string, height: string}}
   */
  size: {
    type: Object,
    value: () => {
      return {
        width: "400",
        height: "400"
      }
    }
  },
  /**
   * Value for `data-chrome` (https://dev.twitter.com/web/embedded-timelines#customize-widget-components)
   *
   * @type 'noheader,nofooter,noborders,noscrollbar,transparent'
  */
  chrome: {
    type: String,
    value: ''
  }
}

API

.loadTimeline(widgetId)

widgetId (optional)

Type: string
Will load (or reload) the timeline with the widget id passed or with the this.dataWidgetId property if setted.

Twitter data-id to feed the timeline:


.removeTimeline()

Remove current timeline.


Events

on-timeline-loaded

After the correct initialization of the library and the timeline

Twtt instance

The Twtt instance is available as this.Twtt

Other references

polymer-lib-loader - for loading the library

Develop

Clone the repository inside a folder (ex: sandbox-twitter-timeline/twitter-timeline) and inside the twitter-timeline folder:

$ npm install && bower install

Developing mode: watch on base files and Babel that transpiles (http://localhost:8080/twitter-timeline/demo)

$ npm start

Build: only the Babel action simply run

$ npm run build

Test

Standard for coding style and WCT for unit test:

$ npm test

License

MIT © LasaleFamine