define([
  'app'
  ], function (App) {
    "use strict";
    // this module provides generic methods usable across all gadgets/modules
    var that = {};

    // Javascript closest()
    that.closest = function (elem, selector) {
      var matchesSelector = elem.matches ||
          elem.webkitMatchesSelector ||
          elem.mozMatchesSelector ||
          elem.msMatchesSelector;

      while (elem) {
        if (matchesSelector.bind(elem)(selector)) {
            return elem;
        } else {
            elem = elem.parentNode;
        }
      }
      return false;
    };

    App.util = that;

    return undefined;
  }
);