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 🙏

© 2026 – Pkg Stats / Ryan Hefner

share-dialog

v0.3.0

Published

Share dialogs for the most common websites

Readme

share-dialog

Creates share dialogs for Facebook, Twitter, Pinterest, Google Plus, Tumblr and LinkedIn.

Install

npm i share-dialog --save

To use in a browser, browserify it.

Usage

See service methods below for specific service args.

var Dialog = require('share-dialog')

// Example to share a link on Twitter
var twitter = Dialog.twitter("http://example.com", "This is my tweet")

// Get the dialog URL
var url = twitter.get()

// Or open it in a new window
twitter.open()

Each of the service methods (e.g. Dialog.twitter) returns a Dialog instance. These instances are reusable:

var dialog = Dialog.tumblr.link('http://example.com/', 'Some link')

dialog.open()
dialog.params({url: 'http://example.com/foo', name: 'Some link with foo'})
dialog.open()

API

Dialog instances

dialog.params({ object }) Overwrite GET parameters of share URL.

dialog.params() Get current parameters.

dialog.config({ object }) Overwrite window configuration. The default configuration is:

{ toolbar: 0
, status: 0
, width: 650  // differs per service
, height: 306
, top: function(config)
  { return screen.availHeight/2 - config.height/2 }
, left: function(config)
  { return screen.availWidth/2  - config.width/2  }  
}

dialog.config() Get current configuration.

dialog.get() Return the dialog URL.

dialog.open() Open the share dialog in a new window.

Service methods

The argument names listed for each service method below, are equal to the GET parameter names. This means..

Dialog.facebook('my_app_id')

.. is the same as writing:

Dialog.facebook().params({app_id: 'my_app_id'})

Facebook

Share dialog (facebook.com/dialog/share?app_id=..)

Dialog.facebook(app_id, href, redirect_uri)

Documentation

Legacy sharer.php (facebook.com/sharer/sharer.php?u=..)

Dialog.facebook(u) where u is the URL to share. Does not require an app id.

Pinterest

Dialog.pinterest(url, media [, description])

Documentation

Tumblr

Share a link: Dialog.tumblr.link(url [, name, description])

Share a photo: Dialog.tumblr.photo(source [, caption, clickthru])

Documentation

Google Plus

Dialog.gplus(url)

Twitter

Dialog.twitter(url [, text, via, in_reply_to, hashtags, related])

  • url (string): the URL you want to share (required)
  • text (string): tweet text (optional)
  • via (string): username (optional)
  • in_reply_to (number or string): status ID of a tweet (optional)
  • hashtags (array): hashtags to append to tweet, e.g. ['food', 'monsters'] (optional)
  • related (array): related Twitter usernames (optional)

Documentation

LinkedIn

Dialog.linkedIn(url[, title, source, summary])

Documentation

Todo

  • testling browser tests