Socket
Book a DemoInstallSign in
Socket

twitter-widgets

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitter-widgets

Wrapper for dynamically loading the Twitter widgets script (follow button, embedded tweets etc.)

2.0.0
latest
Source
npmnpm
Version published
Weekly downloads
259
9.28%
Maintainers
1
Weekly downloads
 
Created
Source

twitter-widgets

Wrapper for dynamically loading the Twitter widgets script (follow button, embedded tweets etc.)

npm install twitter-widgets

Can be used with browserify or global window.TwitterWidgetsLoader.

var TwitterWidgetsLoader = require('twitter-widgets');

TwitterWidgetsLoader.load(function(err, twttr) {
	if (err) {
		//do some graceful degradation / fallback
		return;
	}

	twttr.widgets.createTweet('20', document.getElementById('tweet'));
});

TwitterWidgetsLoader.load(function(err, twttr) {
	if (err) {
		//do some graceful degradation / fallback
		return;
	}

	twttr.widgets.createFollowButton('Prinzhorn', document.getElementById('follow'));
});

//The callback is optional.
TwitterWidgetsLoader.load();
// at some point later `window.twttr` will be defined.

Changelog

2.0.0

  • Make the callback parameter optional (#1)
  • Error-first callback (#2)
  • Always load the script via https:// instead of protocol-relative

1.0.0

  • Always call the callback asynchronously
  • Fixed a bug with infinite recursion when nesting load() calls

Keywords

twitter

FAQs

Package last updated on 20 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.