I am building a simple charting tool. When a user chooses a data source and a chart type, both the data and the script for the specific chart (.js) are loaded and then the code
If you want it really lightweight, You should try sb-promise, It's under MIT license. It's just a few kbs and is API compatible with native Promises.
function myFunction(){
return new Promise(function(resolve,reject){
resolve({some:"data"});
}
}
myFunction().then(function(result){
console.log(result); // {some:"data"}
});