-
Notifications
You must be signed in to change notification settings - Fork 1
/
utilify.min.js
1 lines (1 loc) · 3.98 KB
/
utilify.min.js
1
!function o(r,i,u){function f(t,n){if(!i[t]){if(!r[t]){var e="function"==typeof require&&require;if(!n&&e)return e(t,!0);if(c)return c(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}e=i[t]={exports:{}},r[t][0].call(e.exports,function(n){return f(r[t][1][n]||n)},e,e.exports,o,r,i,u)}return i[t].exports}for(var c="function"==typeof require&&require,n=0;n<u.length;n++)f(u[n]);return f}({1:[function(n,t,e){"use strict";var o={put:function(n,r,i,u){return new Promise(function(t,e){var o=new XMLHttpRequest;o.open("PUT",n,!0),o.setRequestHeader("Content-type","application/json; charset=utf-8"),o.onload=function(){var n=o.responseText;4==o.readyState&&"200"==o.status?("function"==typeof i&&i(n),"function"==typeof t&&t(n)):("function"==typeof u&&u(n),"function"==typeof e&&e(n))},o.send(JSON.stringify(r))})},get:function(n,r,i){return new Promise(function(t,e){var o=new XMLHttpRequest;o.open("GET",n,!0),o.onload=function(){var n=o.responseText;4==o.readyState&&"200"==o.status?("function"==typeof r&&r(n),"function"==typeof t&&t(n)):("function"==typeof i&&i(n),"function"==typeof e&&e(n))},o.send(null)})},post:function(n,r,i,u){return new Promise(function(t,e){var o=new XMLHttpRequest;o.open("POST",n,!0),o.setRequestHeader("Content-type","application/json; charset=utf-8"),o.onload=function(){var n=o.responseText;4==o.readyState&&"200"==o.status?("function"==typeof i&&i(n),"function"==typeof t&&t(n)):("function"==typeof u&&u(n),"function"==typeof e&&e(n))},o.send(JSON.stringify(r))})},delete:function(n,r,i,u){return new Promise(function(t,e){var o=new XMLHttpRequest;o.open("DELETE",n,!0),o.setRequestHeader("Content-type","application/json; charset=utf-8"),o.onload=function(){var n=o.responseText;4==o.readyState&&"200"==o.status?("function"==typeof i&&i(n),"function"==typeof t&&t(n)):("function"==typeof u&&u(n),"function"==typeof e&&e(n))},o.send(JSON.stringify(r))})}};void 0!==t&&(t.exports=o),"undefined"!=typeof window&&(window.Ajax=o)},{}],2:[function(n,t,e){"use strict";function o(n,t){for(var e in t)if(t.hasOwnProperty(e)){if(t[e]==t)return n[e]=t,n;"object"==r(t[e])?n[e]=o({},t[e]):n[e]=t[e]}return n}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},i=n("./ajax"),u={},n={set:function(n,t){return u[n]=t},get:function(n){return u[n]},remove:function(n){delete u[n]},clearAll:function(){u={}}},f={},c=[];f.listenTo=function(n,t,e){c.push({eventName:t,context:n,callback:e})},f.once=function(t,e,o){var r=function(n){o(n),f.off(t,e,r)}.bind(this);c.push({eventName:e,context:t,callback:r})},f.trigger=function(e,o,r){c.forEach(function(n,t){n.eventName===o&&n.context===e&&n.callback(r)})},f.off=function(n,t,e){for(var o=0;o<c.length;o++){var r=c[o];void 0===e?r.eventName===t&&r.context===n&&(c.splice(o,1),o--):r.eventName===t&&r.context===n&&r.callback===e&&(c.splice(o,1),o--)}};i={UUID_NIL:"00000000-0000-0000-0000-000000000000",EnumGenerator:function(n){for(var t in n)n.hasOwnProperty(t)&&(isNaN(Number(t))?n[n[t]]=t:n[n[t]]=Number(t));return n},getCurrentEpochTime:function(){var n=new Date;return parseInt(n.getTime()/1e3)},CacheMgr:n,clone:function(n){return o({},n)},deepCopy:o,copy:function(n,t){return t=Object.assign(n,t)},defaultsGenerator:function(n){var t=0<arguments.length&&void 0!==n?n:{};return function(n){return Object.assign({},t,n)}},EventManager:f,isNumber:function(n){return"number"==typeof n},isFunction:function(n){return"function"==typeof n},isString:function(n){return"string"==typeof n},isBoolean:function(n){return"boolean"==typeof n},isArray:function(n){return"function"==typeof Array.isArray?Array.isArray(n):n instanceof Array},argumentsToArray:function(n){for(var t=[],e=0;e<n.length;e++)t.push(n[e]);return t},removeDuplicates:function(n){var t=[];return n.forEach(function(n){-1==t.indexOf(n)&&t.push(n)}),t},Ajax:i};void 0!==t&&(t.exports=i),"undefined"!=typeof window&&(window.Utilify=i)},{"./ajax":1}]},{},[2]);