'use strict';

var angular = require('angular'),
  Swipe = require('swipe');
require('../modules');

angular
  .module('infoDisplay.directives')
  .factory('sinoSwipe', sinoSwipe);
  
/** @ngInject*/
function sinoSwipe($window) {
  var sinoSwipe = {
    swipe: null,
    getInstance: getInstance
  };
  
  return sinoSwipe;
  
  function getInstance() {
    if (!sinoSwipe.swipe) {
      return Swipe($window.document.getElementsByClassName('swipe')[0], {
        continuous: false,
        bouncing: true
      }); 
    } else {
      return sinoSwipe.swipe;
    }
  }
  
}