Getting Twitter events to work
Just a short tip this week (1 day late mind you):
I've been trying to make a function call when a user is Tweeting using my "Tweet" button:
Twitter has a nice function set to make sure you can react to different events happening, like:
tweet, follow, retweet, favorite, click.
It's pretty easy to understand what all of those do, in my case ("tweet") only when the user clicks the Tweet button on the following popup:
the function is called.
This is an example script to make this happen:
|
|
My mistake was that I forgot making sure Twitter was ready (very much like document.ready), like this:
|
|
Here's a comprehensive list of the events & what they do from Twitter's website.
I've also added a working example of the script.
Posted in
Technology