fix(core): update

This commit is contained in:
Philipp Kunz 2021-05-31 13:02:22 +02:00
parent 9f6d88e162
commit c761cc4460
4 changed files with 16160 additions and 1470 deletions

17568
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,12 +19,11 @@
"url": "https://gitlab.com/pushrocks/smartq/issues"
},
"homepage": "https://gitlab.com/pushrocks/smartq#README",
"dependencies": {},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.52",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.11.8",
"@gitzone/tstest": "^1.0.54",
"@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^15.6.1",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},

View File

@ -86,7 +86,6 @@ myPromisedFunction('helloThere', 2).then((x) => {
});
```
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)

54
test/test.readme.node.ts Normal file
View File

@ -0,0 +1,54 @@
import * as smartpromise from '../ts';
// using Deferreds
// simple deferred;
const done = smartpromise.defer();
done.promise.then((stringArg) => {
console.log(stringArg);
});
done.resolve('hello') // whenever you are ready
// using deferreds in async functions to cater callback style apis
const myAsyncFunction = async (): Promise<string> => {
const done = smartpromise.defer<string>(); // returns your typical Deferred object
setTimeout(() => {
done.resolve('hi'); // will throw type error for other types than string as argument ;)
}, 6000);
console.log(done.status); // logs "pending";
await done.promise;
console.log(done.status); // logs "fullfilled"
console.log(done.duration); // outputs the duration in millisenconds
return done.promise;
};
let myAsyncFunction2 = async () => {
let aString = await myAsyncFunction();
console.log(aString); // will log 'hi' to console
};
myAsyncFunction2();
// Resolved and Rejected promises
// ------------------------------------------------
smartpromise.resolvedPromise(`I'll get logged to console soon`).then((x) => {
console.log(x);
});
smartpromise
.rejectedPromise(`what a lovely error message`)
.then(
() => {
console.log('This never makes it to console');
} /*, alternatively put a reject function here */
)
.catch((err) => {
console.log(err);
});
import {tap, expect } from '@pushrocks/tapbundle';
tap.test('runs through', async () => {})
tap.start();