Your SlideShare is downloading. ×
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
TwitterLib.js
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

TwitterLib.js

3,492

Published on

A walk through of the features of TwitterLib.js - a library that helps standardise all the Twitter API calls and all the data coming back from Twitter, and includes a collection of utility methods to …

A walk through of the features of TwitterLib.js - a library that helps standardise all the Twitter API calls and all the data coming back from Twitter, and includes a collection of utility methods to speed development up.

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total Views
3,492
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
16
Comments
1
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. TwitterLib.js
  • 2. What is it?
  • 3. Why?
  • 4. http://github.com/remy/twitterlib
  • 5. Examples
  • 6. Features
  • 7. Features •Consistent interface & data structure •Support for custom APIs •Automatic paging •Included utilities: •ify, render, time
  • 8. API
  • 9. timeline status favs search list
  • 10. <script src="twitterlib.js"></script>
  • 11. <script src="twitterlib.js"></script> <script> var tweets = document.getElementById('tweets'); twitterlib.timeline('rem', function (data) { }); </script>
  • 12. <script src="twitterlib.js"></script> <script> var tweets = document.getElementById('tweets'); twitterlib.timeline('rem', function (data) { var html = []; for (var i = 0; i < data.length; i++) { html.push(data[i].text); } }); </script>
  • 13. <script src="twitterlib.js"></script> <script> var tweets = document.getElementById('tweets'); twitterlib.timeline('rem', function (data) { var html = []; for (var i = 0; i < data.length; i++) { html.push(twitterlib.render(data[i])); } }); </script>
  • 14. <script src="twitterlib.js"></script> <script> var tweets = document.getElementById('tweets'); twitterlib.timeline('rem', function (data) { var html = []; for (var i = 0; i < data.length; i++) { html.push(twitterlib.render(data[i])); } tweets.innerHTML = html.join(''); }); </script>
  • 15. <script src="twitterlib.js"></script> <script> var tweets = document.getElementById('tweets'); twitterlib.status('rem', function (data) { var html = []; for (var i = 0; i < data.length; i++) { html.push(twitterlib.render(data[i])); } tweets.innerHTML = html.join(''); }); </script>
  • 16. <script src="twitterlib.js"></script> <script> var tweets = document.getElementById('tweets'); twitterlib.favs('rem', function (data) { var html = []; for (var i = 0; i < data.length; i++) { html.push(twitterlib.render(data[i])); } tweets.innerHTML = html.join(''); }); </script>
  • 17. <script src="twitterlib.js"></script> <script> var tweets = document.getElementById('tweets'); twitterlib.list('rem/local', function (data) { var html = []; for (var i = 0; i < data.length; i++) { html.push(twitterlib.render(data[i])); } tweets.innerHTML = html.join(''); }); </script>
  • 18. <script src="twitterlib.js"></script> <script> var tweets = document.getElementById('tweets'); twitterlib.search('@rem', function (data) { var html = []; for (var i = 0; i < data.length; i++) { html.push(twitterlib.render(data[i])); } tweets.innerHTML = html.join(''); }); </script>
  • 19. Options
  • 20. Options twitterlib.timeline('rem', fn); twitterlib.timeline('rem', {/*options*/}, fn);
  • 21. Options • page: 1 • limit: 200 • since_id: 1 • filter: 'foo'
  • 22. Options twitterlib.timeline( 'rem', { since_id: 123, filter: 'foo' }, fn );
  • 23. Filter
  • 24. Filter foo
  • 25. Filter foo foo bar (foo and bar)
  • 26. Filter foo foo bar (foo and bar) foo OR bar
  • 27. Filter foo foo bar (foo and bar) foo OR bar "foo bar" (atomic string)
  • 28. Filter foo foo bar (foo and bar) foo OR bar "foo bar" (atomic string) foo -bar (foo, not bar)
  • 29. Filter foo foo bar (foo and bar) foo OR bar "foo bar" (atomic string) foo -bar (foo, not bar) from:rem foo
  • 30. Filter foo foo bar (foo and bar) foo OR bar "foo bar" (atomic string) foo -bar (foo, not bar) from:rem foo to:rem foo
  • 31. Utilities
  • 32. Utilities .custom(name, url)
  • 33. Utilities twitterlib.custom('dm', '/tweets?page=%page%&type=dm'); twitterlib.dm(callback);
  • 34. Utilities .next()
  • 35. Utilities var html = []; twitterlib.timeline('rem', {limit: 5}, function(tweets){ for (var i = 0; i < tweets.length; i++) { html.push(this.render(tweets[i])); } })
  • 36. Utilities var html = []; twitterlib.timeline('rem', {limit: 5}, function(tweets){ for (var i = 0; i < tweets.length; i++) { html.push(this.render(tweets[i])); } }).next();
  • 37. Utilities .render(tweet)
  • 38. Utilities .ify.clean(text)
  • 39. Utilities List of Twitter developers in the @WiredUK photo: @nuxnix/uk- twitterati #devnest: http://www.wired.co.uk/wired-magazine/ archive/2009/12/start/wired%27s-guide-to-the-uk-twitterati.aspx List of Twitter developers in the @WiredUK photo: @nuxnix/uk-twitterati #devnest: http://www.wired.co.uk/w...
  • 40. Utilities .time.relative(t)
  • 41. Utilities Fri Jan 08 15:44:49 +0000 2010 20 minutes ago
  • 42. Photos by Balakov Enjoy. @rem http://j.mp/dnfeb

×