-
Notifications
You must be signed in to change notification settings - Fork 2
/
hobo.js
74 lines (58 loc) · 1.9 KB
/
hobo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*!
*
*
* Hobo
* A very small, modular DOM utility for modern web apps.
* @hobo-dist npm run build
*
* @links
* https://developer.mozilla.org/en-US/docs/Web/API/Node
* https://developer.mozilla.org/en-US/docs/Web/API/Element
* https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
*
* https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
*
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
* https://github.com/jakearchibald/es6-promise
* http://www.html5rocks.com/en/tutorials/es6/promises/
*
*
*/
(function ( factory ) {
if ( typeof exports === "object" && typeof module !== "undefined" ) {
module.exports = factory();
} else if ( typeof window !== "undefined" ) {
window.hobo = factory();
}
})(function () {
var Hobo = require( "./lib/Hobo" ),
utils = require( "./lib/utils" );
// Core Hobo methods:
Hobo.prototype.on = require( "./lib/core/on" );
Hobo.prototype.off = require( "./lib/core/off" );
Hobo.prototype.data = require( "./lib/core/data" );
Hobo.prototype.find = require( "./lib/core/find" );
Hobo.prototype.addClass = require( "./lib/core/addClass" );
Hobo.prototype.removeClass = require( "./lib/core/removeClass" );
// Extended Hobo methods:
// @hobo-ext
/**
*
* @global
* @public
* @method hobo
* @description Wrapper for `Hobo` instances.
* @param {string} selector The parameter passed to `querySelectorAll`
* @param {element} context The Element used to call `querySelectorAll`
* @returns {Hobo}
*
*/
hobo = function ( selector, context ) {
return new Hobo( selector, context );
};
// Attach Hobo utilities to `wrapper` method
hobo.ajax = require( "./lib/core/ajax" );
// Attach Hobo internal utils to `wrapper` method
hobo.utils = utils;
return hobo;
});