1.5.43 • Published 5 years ago

peprze v1.5.43

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Peprze

Promise shim and functionality extender

NPM version

Table of contents

What is it?

This library allows to use promises in older browsers as well as add extra functionality to promises that allows promise functionality in the kaleo library set

Installation

This libray can be installed using:

  • NPM : npm install peprze --save
  • Bower : bower install peprze --save
  • Yarn : yarn add peprze

Getting started

The script can be loaded both in the head and in the body. All functionality is automatically loaded as soon as the file is loaded. Note: include this script before any other scripts for proper implementation

 <script src="/(node_modules|bower_modules)/peprze/peprze.min.js"></script>

To start using it is as simple as instancing a new promise in the same way as native promises

 var test = new Promise(function(resolve, reject){
  /* Do async here */
 })

Examples

Fetching files

Using Xhr to fetch files using promises

function fetchfile(url) {
  var xhr = new XMLHttpRequest();
  xhr.open('GET', url, true);
  
  return new Promise(function(resolve, reject){
    xhr.onreadystatechange = function() {
      if(xhr.readyState === 4) {
        if(xhr.status === 200) {
          resolve(xhr.responseText);
        }
        else {
          reject(new Error(xhr.status));
        }
      }
    }
    
    xhr.send();
  });
}

How to contribute

If You would like to contribute here are the steps

  1. Clone Repo: Peprze Github Repo
  2. Install any necessary dev dependencies
  3. build the project npm run build
  4. test your changes don't break anything npm test
  5. Make a pull request on github for your changes :)

License

You can view the license here: License

1.5.43

5 years ago

1.5.42

5 years ago

1.5.41

5 years ago

1.5.40

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.6

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.8

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.0

5 years ago