hatchyt
Version:
Hatch your next idea.
104 lines (90 loc) • 2.93 kB
JavaScript
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ajaxLoader = __webpack_require__(4);
var _ajaxLoader2 = _interopRequireDefault(_ajaxLoader);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
(function () {
if (!window.hatchyt) {
window.hatchyt = {};
}
window.hatchyt.version = "0.0.1"; // could load package.json everytime..
})(); // SHARED SCRIPT ACCROSS ALL PAGES
//# sourceMappingURL=hatchyt.js.map
/***/ },
/* 1 */,
/* 2 */,
/* 3 */,
/* 4 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (query, options) {
options = Object.assign(defaultOptions, options);
var nodes = document.querySelectorAll(query);
Array.from(nodes).forEach(function (element) {
element.addEventListener(options.event, options.handler || function (e) {
e.preventDefault();
var domNode = e.target;
domNode.classList.add(options.waitingClass);
var uri = options.uri || domNode.getAttribute('href');
fetch(uri, console.log);
return false;
});
});
};
// does ajax-y things
// hatchIt(<querySelector>, options)
var defaultOptions = {
event: 'click',
waitingClass: 'loading'
};
//# sourceMappingURL=ajaxLoader.js.map
/***/ }
/******/ ]);
//# sourceMappingURL=hatchit.packed.js.map