oleboleskole3 / HelperLibraries

These are some short libraries i make to help myself

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(NOTE: This is very old, and the functions aren't even helpful compared to other libraries that do the same. I don't even think the ES6Arrayfunctions.js files worked at all. Im only keeping this so you can look/laugh at my past mistakes)

HelperLibraries

These are some short libraries i make to help myself.

--> ES6Arrayfunctions.js

--> reqSender.js

--> Credits

This library is made to bring the glorius ES6 arr.(map || filter || reduce) into older javascript versions.

To use just link either the ES6Arrayfunctions.js or the minified ES6Arrayfunctionsmin.js.

This library is made to easily send get/post/put/patch/detete reqests, it has both synchronous and asynchronous support. It is also backwards compatible, since i had a hard time not using arrow functions and other things

Remember to link either reqSender.js or the minified reqSendermin.js in your head tag

Syntax

To send a synchronous request to any url you use getDataSync(method : ('get' || 'post' || 'put' || 'patch' || 'delete'), url : String); -> returns an XMLHttpRequest object with all of your data

Example:
// Send a synchronous get reqest to '/data.json' and console.log it
var data = JSON.parse(getDataSync('get', '/data.json').responseText);
console.log(data)

To send an asynchronous request to any url you use getDataAsync(method : ('get' || 'post' || 'put' || 'patch' || 'delete'), url : String, callbackfn : function(request : XMLHttpRequest object with all of your data));

Example:
// Send an asynchronous get reqest to '/data.json' and console.log it
getDataAsync('get', '/data.json', function(req) {
  var data = JSON.parse(req.responseText);
  console.log(data);
});

All of the minified scripts were made though this js minifier.

About

These are some short libraries i make to help myself


Languages

Language:JavaScript 100.0%