sjpromise

sudo npm install sjpromise

Usage no npm install needed!

<script type="module">
  import sjpromise from 'https://cdn.skypack.dev/sjpromise';
</script>

README

SJPROMISE

It Just a Simple Implemention of Promise Pattern like we have in AngularJS 1.x.

Installation

sudo npm install sjpromise

Functions


    var promise = require("sjpromise");

    function createPromise(){
        
            var defer = new promise();
            
            setTimeout(function(){
                defer.resolve({data:"Data"});
            },100);
            
            return defer.promise;
    }
    
    function consumePromise(){
        createPromise().then(function(result){
            console.log("Result: ",result);
        },function(err){
            console.log("Error: ",err);
        })
    }

    consumePromise();