persisted-requests
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-prerelease • Public • Published

Persisted Requests

Maintenance made-with-javascript License: GPL v3

This library allows REST requests to be made from a client without the original context of the request becoming lost in the event the user moves away from the website, or if the page crashes.

This is done by persisting each request in storage before it is sent out. By default, the request then gets removed from storage after it is fulfilled by the server.

Installation Steps

Using NPM: npm install --save persisted-requests

Using Yarn: yarn add persisted-requests

Supported Environments

  • Firefox
  • Chrome
  • Safari

See the browsers section of karma.conf.js for the list of browsers for which tests were ran on.

Supported Persistence Types

  • LocalStorage
  • In-Memory

Supported REST Client

Only Axios is supported for now, future support for other clients will be contingent on the usage of this library.

Unsupported / Untested Request Features

  • Cookies
  • The following Request Body types:
    • XPath
    • XML
    • XML Schema
    • JSON Schema
    • regular expression
    • plain text

Testing

Only end-to-end testing was done for now due to the relative small size of this project. See the tests folder for them.

The tests can be run by calling npm run test. Karma was used with Jasmine to run them in the browser, with Jasmine-Ajax used for capturing the requests sent using an XMLHTTPRequest() spy.

Make sure to set "declaration": false in tsconfig.json before running tests. This is a tech debt to clean up.

Demo

The demo app contains example usage for this library, and also demonstrates what it does under the hood.

Package Sidebar

Install

npm i persisted-requests

Weekly Downloads

0

Version

1.0.0-prerelease

License

GPL-3.0-or-later

Unpacked Size

86.9 kB

Total Files

43

Last publish

Collaborators

  • tehtea