-
Notifications
You must be signed in to change notification settings - Fork 16
1. Getting Started
OpenShare is extremely easy to get set up and rocking with. The fastest way to get started is to include a link from the CDN in a script tag just before your closing body tag.
<!doctype html>
<body>
<script src='https://cdn.rawgit.com/OpenShare/openshare/master/dist/openshare.js'></script>
</body>
The CDN doesn't guarantee up time. If you want to be safe, you can download the minified openshare.js file directly and include in a script tag just before your closing body tag.
<!doctype html>
<body>
<script src='your-folder/openshare.js'></script>
</body>
The best way to install OpenShare is through npm:
npm install openshare --save
and then require
it in your js:
var OpenShare = require('openshare')
The OpenShare module will return an object containing Share and Count functions which can be called like so, read more about the JavaScript API.
var shareNode = new OpenShare.share(options, element)
var countNode = new OpenShare.count(options)
If you are not using the JavaScript API (only the Data Attribute API) then all you need to do is:
require('openshare') // data attribute API just works 🚀
You can also require
just the parts of OpenShare that you need. For example if you only need to create share nodes:
var share = require('openshare/share')
var shareNode = new share(options, element)
Or if you only need to create count nodes:
var count = require('openshare/count')
var countNode = new count(options)
We include a pre-transpiled and minified ES5 version of OpenShare with the npm module.
var OpenShare = require('openshare/dist/openshare')