mirror of
https://github.com/Fechin/reference.git
synced 2026-11-21 05:24:10 +03:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
857d31fcba
2 files changed
+25
-2
No files matched your search
@@ -65,8 +65,8 @@ Min Hour Day Mon Weekday
|
||||
|
||||
| `15 2 * * 1L` | At 2:15am on the last monday of every month |
|
||||
| `15 0 * * 4#2` | At 00:15am on the second thursday of every month |
|
||||
| `0 0 0 1 * *` | Every 1st of month (monthly) |
|
||||
| `0 0 0 1 1 *` | Every 1st of january (yearly) |
|
||||
| `0 0 1 * *` | Every 1st of month (monthly) |
|
||||
| `0 0 1 1 *` | Every 1st of january (yearly) |
|
||||
|
||||
| `@reboot` | Every reboot <br>_(non-standard)_ |
|
||||
|
||||
|
||||
@@ -1366,6 +1366,29 @@ promise.then(res => {
|
||||
});
|
||||
```
|
||||
|
||||
### Fake http Request with Promise
|
||||
|
||||
```javascript
|
||||
const mock = (success, timeout = 1000) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
if(success) {
|
||||
resolve({status: 200, data:{}});
|
||||
} else {
|
||||
reject({message: 'Error'});
|
||||
}
|
||||
}, timeout);
|
||||
});
|
||||
}
|
||||
const someEvent = async () => {
|
||||
try {
|
||||
await mock(true, 1000);
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
JavaScript Async-Await {.cols-2}
|
||||
|
||||
Reference in new issue
Block a user