Skip to content

John-Willikers/Talaria

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Talaria

A lightweight XMLHTTPRequest Wrapper

This is a lightweight wrapper that allows people to easily make GET and POST request Asynchronously and Synchronously.

Synchronous GET example

  //Create a new XMLHttpRequest object that has Talaria wrapped around it
  let request = new Talaria('/users', 'GET', false); // Run Talaria Synchronously
  request.send();
  console.log(request.responseText);

Synchronous POST example

  //Create a new XMLHttpRequest object that has Talaria wrapped around it
  let request = new Talaria('/user', 'POST'); // Run Talaria Synchronously, 3rd arg defaults to true
  request.append([
    {name: 'username', value: 'johnwilliker' },
    {name: 'dob', value: '05/04/1999'}
  ]);
  request.send();
  
  console.log(request.responseText);

Asynchronous POST example

  //Create a new XMLHttpRequest object that has Talaria wrapped around it
  let request = new Talaria('/user', 'POST'); // Run Talaria Asynchronously, 3rd arg defaults to true
  request.append([
    {name: 'username', value: 'johnwilliker' },
    {name: 'dob', value: '05/04/1999'}
  ]);
  request.ready((response) => {
    //returns response body or if JSON an Object
  });
  
  request.send()

About

A lightweight XMLHTTPRequest Wrapper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published