Wrapper of Twitter Widget.js as a customizable Polymer 1.0 WebComponent in ES6 syntax.
<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.
$ bower install polymer-twitter-timeline
{
/** 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: ''
}
}
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:
- Create a new widget: https://twitter.com/settings/widgets/new
- Get the data from whatever source you want
- Get the data-widget-id
Remove current timeline.
After the correct initialization of the library and the timeline
The Twtt
instance is available as this.Twtt
polymer-lib-loader
- for loading the library
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
Standard for coding style and WCT for unit test:
$ npm test
MIT © LasaleFamine