2.2.0 • Published 11 months ago

js-smart-request-cache v2.2.0

Weekly downloads
3
License
ISC
Repository
github
Last release
11 months ago

js-smart-request-cache

RequestHelper

Signature:

class RequestHelper {
    static timeToExpireInMilliseconds: number; // the time (milliseconds) it takes to invalidate the cached value.
    static GET(url: string, fetchOptions?: object, forceRequest?: boolean, responseType?: RequestResponseType, acceptableStatusCodes?: number[]): Promise<any>;
}

Example:

RequestHelper.timeToExpireInMilliseconds = 10000;

RequestHelper.GET("https://example.com/api/orders?id=1", {
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
    },
    false,
    RequestResponseType.Json,
    [200, 201]
})
    .then((response) => {
        // Handle Response ...
    })
    .catch((e) => {
        // Handle Error ...
    });
2.2.0

11 months ago

2.1.0

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago