Skip to content

migme/beachball

Repository files navigation

Migme JS SDK

Migme JavaScript SDK. Throws data to the Migme API.

Gitter Codeship Codecov Dependency Status npm npm GitHub Releases

Beachball Migbot

Installation

NPM

npm install migme

Usage

Loading

// ES6
import Migme from 'migme'

// CommonJS
var Migme = require('migme')

// AMD
define(['migme'], function (Migme) {
  // ...
})

Loading in browser

<script>
window.migmeAsyncInit = function() {
  MIGME.init({
    client_id  : 'your-client-id',
    version    : 'v1.0',
  });
};

(function(d, s, id){
   var js, mjs = d.getElementsByTagName(s)[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement(s); js.id = id;
   js.src = "//connect.mig.me/lib/sdk.js";
   mjs.parentNode.insertBefore(js, mjs);
 }(document, 'script', 'migme-jssdk'));
</script>

Share Buttons

Create a share button on your site. (Initialization is required)

<div class="migme-share-button"
  data-href="http://www.your-domain.com/your-page.html"
  data-layout="button">
</div>

Initialization

MIGME.init({
  // options
  client_id: 'XXXXXXXXXXXXX',
  access_token: '' // If you already have one
})

Development

npm install # Install dependencies
npm test    # Test only
npm run build  # Build only