0.1.2 • Published 6 years ago

simply-requests v0.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Simply Requests

A simple module that handles requests.

A work-in-progress Javascript module.

Built by: Mario Lo

Install

yarn add simply-requests

Functions

httpRequest

import { xmlHttpRequest } from 'simply-requests';

const myCallback = (response) => {
    console.log('response: ', response);
};

(() => {
    xmlHttpRequest('/data/menu.json', myCallback);
})();

Parameters

Parameter NameTypeRequiredDefault ValueDescription
filePathstringtruenullrelative path to your file
callBackFnfunctiontruenullfunction to call and return request in callback parameter

filePath

type: string

The path to your file

callBackFn

type: function

Function to call when a response happens

Return value

Response StateValue
DoneResponse
Errorundefined
Completed but not donenull

xmlHttpRequestOnSuccess

import { xmlHttpRequestOnSuccess } from 'simply-requests';

const myCallback = (response) => {
    console.log('response: ', response);
};

(() => {
    xmlHttpRequestOnSuccess('/data/menu.json', myCallback);
})();

Parameters

Parameter NameTypeRequiredDefault ValueDescription
filePathstringtruenullrelative path to your file
callBackFnfunctiontruenullfunction to call and return request in callback parameter

filePath

type: string

The path to your file

callBackFn

type: function

Function to call when a response happens

Return value

This only returns a response on success

Response StateValue
DoneResponse

Future Features

  • Have future features

Feature Request

Please message hello@websitesbymario.com for feature requests.

Bug Report

Please message hello@websitesbymario.com to report bugs.

Bug List

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago