npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cdf/cdf-ng-tweet

v1.0.2

Published

Angular Component for Twitter

Downloads

10

Readme

CDF Tweet UI Module (@cdf/cdf-ng-tweet)

version downloads

CDF-NG-TWEET is an Angular module containing UI components for displaying Twitter tweeets. CDF-NG-TWEET is a UI module existing in Content Delivery Framework's eco-system.

Happy Coding!

Requirements

CDF-NG-TWEET requires the latest version of Angular (at the time of this writing: 2.4.7).

  //package.json
  
  "dependencies": {
    "@angular/common": "2.4.7",
    "@angular/compiler": "2.4.7",
    "@angular/core": "2.4.7",
    "@angular/forms": "2.4.7",
    "@angular/http": "2.4.7",
    "@angular/platform-browser": "2.4.7",
    "@angular/platform-browser-dynamic": "2.4.7",
    "@angular/router": "3.4.7"
	...
  }

Installation

Installing CDF-NG-TWEET in your Angular application:

    //INSTALL CDF-NG-TWEET

    npm install @cdf/cdf-ng-tweet --save
    

How to use CDF-NG-TWEET


//STEP 1: QUERY TWITTER FOR TWEETS
     
    getTweets() : Observable<any> 
    {
         let url = 'https://api.twitter.com/1.1/statuses/user_timeline.json?count=20&screen_name=XXXXX';
         
         return this.http.get(url)
                         .map((res:Response) => res.json())
                         .catch((error:any) => Observable.throw(error.json().error));
    }

//STEP 2 CONVERT RAW JSON FROM TWITTER INTO CdfTweetModel
	
	import { CdfTweetModel } from '@cdf/cdf-ng-tweet/lib';

	...

	tweetList : CdfTweetModel[] = [];
	
	getTweets().subscribe
	(
		(rawJson) =>
		{
			//TWITTER DATA
			for (let entry of rawJson) 
			{
				this.tweetList.push(new CdfTweetModel(entry));
			}			
		}
	);

//STEP 3 Display Tweets

	<section *ngFor="let item of tweetList">
		<cdf-tweet [tweetModel]="item"></cdf-tweet>
	</section>

CDF-NG-TWEET Models

CDF-NG-TWEET containes the following models:

  • CdfTweetModel
  • CdfTweetUserModel

CdfTweetModel

CdfTweetModel is the model containing data about a Tweet from Twitter. CdfTweetModel contains the following data points:

	Id: string;
	Text: string;
	User: CdfTweetUserModel;
	MediaUrl: string;
	HashTags: string[] = [];
	CreatedAt: string;
	TimeStamp: Date; 

CdfTweetUserModel

CdfTweetUserModel is the model containing data about the Tweet author. CdfTweetUserModel contains the following data points:

	Id: string;
	Name: string;
	ScreenName: string;
	Description: string;
	Location: string;
	ProfileImageUrl: string;
	ProfileImageUrlHttps: string;	
	CreatedAt : string;

CDF-NG-TWEET Components

CDF-NG-TWEET containes the following components:

  • CdfTweetComponent

CdfTweetComponent

CdfTweetComponent is the component used to display a Twitter tweet. CDF-NG-TWEET contains a service, CdfTweetService, responsible for loading Twitter JavaScript widget (https://platform.twitter.com/widgets.js). See Twitter Embeded Timelines for more details.

The Twitter widget is responsible for rendering a tweet. This component relies upon a connection to Twitter to render the tweet. If the connection is lost, or is not available, then the component simply renders the Tweet's text and timestamp. Otherwise, if a connection exists, the component uses Twitter's JavaScript widget to render the tweet.

Tweet rendered by Twitter:

Tweet rendered when Twitter not loaded/available:

Helpful Links

Release History

  • 1.0.0
    • initial development

Meta

Tom Schreck – @tschreck[email protected]

https://github.com/tomschreck

License

MIT