SuperShare Documentation

Social media sharing utility for web developers. Simple. Fast. Plug and play.

Installation

Using NPM (CommonJS)

npm install super-share

Using CDN (Browser)

<script src="https://cdn.jsdelivr.net/npm/super-share/dist/index.min.js"></script>

This adds SuperShare to window.

Usage

CommonJS (Node, Express, etc.)

const SuperShare = require('super-share');

const share = new SuperShare({
  url: 'https://example.com',
  text: 'Check this out!',
  hashtags: 'javascript,webdev'
});

Browser

<script src="https://cdn.jsdelivr.net/npm/super-share/dist/index.min.js"></script>
<script>
  const share = new SuperShare({
    url: 'https://example.com',
    text: 'Check this out!',
    hashtags: 'webdev,javascript'
  });

  share.attachShareHandlers(); // Optional
</script>

API Reference

getShareUrl(platform: string)

Returns a platform-specific share URL.

const twitterUrl = share.getShareUrl('twitter');

getAllShareUrls()

Returns all available share URLs as an object.

const urls = share.getAllShareUrls();
console.log(urls.facebook);

attachShareHandlers()

Automatically binds click handlers to all elements with data-share attribute. Accepts no arguments.

// Binds to [data-share] elements
      share.attachShareHandlers();

Supported Platforms

FacebookTwitterLinkedIn WhatsAppTelegramReddit PinterestEmailTumblr BufferVKXing SMSPocketFlipboard InstapaperSkypeLine MixDiggWeiboSnapchat
Donate

Support My Work

Scan & donate via UPI:
pareekaman1@ybl

Even small contributions make a big difference 💖

License

MIT