Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- /**
- * Description.
- * @class
- * @augments [class]
- * @param {Object} options - Options object.
- * @param {string} options.opt1 - CSS selector of [some] element
- * @param {string} options.opt2 - CSS selector of [some] element
- * @version 1.0.0-alpha
- * @author Daur Gamisonia <daurgam@gmail.com>
- */
- function Obj( options ) {
- this._opt1 = options.opt1;
- this._opt2 = options.opt2;
- this.listen = function() {
- document.body.addEventListener( "click", this._handle );
- };
- this._handle = function( event ) {
- var target = event.target;
- while( true ) {
- if ( target == document.body ) {
- break;
- }
- if ( !target.classList.contains("some-class") {
- target = target.parentElement;
- continue;
- }
- break;
- }
- };
- this.open = function() {
- ...
- };
- this.close = function() {
- ...
- };
- };
- var func = new Obj({
- opt1: "value",
- opt2: "value"
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement