UNPKG

click-outside-js

Version:

Standalone javascript library to make click outside event

9 lines (8 loc) 702 B
/*! Copyright (c) 2016 Naufal Rabbani (http://github.com/BosNaufal) * Licensed Under MIT (http://opensource.org/licenses/MIT) * * Click Outside JS - Version@0.0.1 * */ (function(){function a(a,b){this.evt=function(c){var d=a.contains(c.target);if(c.target!=a&&!d)return b?b():null};document.addEventListener("click",this.evt,!1);return this}a.prototype.remove=function(){document.removeEventListener("click",this.evt,!1)};a.prototype.reinit=function(){document.addEventListener("click",this.evt,!1)};"object"===typeof module&&"object"===typeof exports?module.exports=a:"function"===typeof define&&define.amd?define([],a):"object"===typeof exports?exports.onClickOutside= a:window.onClickOutside=a})();