This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Ultra lightweight Github REST Client */ | |
const token = 'github-token-here' | |
const githubClient = generateAPI('https://api.github.com', { | |
headers: { | |
'User-Agent': 'xyz', | |
'Authorization': `bearer ${token}` | |
} | |
}) | |
async function getRepo() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new PROMISE | |
// This requires 2 PARAMETERS 'resolve' and 'reject' | |
const p = new Promise((resolve, reject) => { | |
// 'setTimeout' to simulate a 1s delay | |
setTimeout(() => resolve('done!'), 1000) | |
}) | |
// DECLARE a new FUNCTION, 'f' as 'async' - need 'async' to use 'await' | |
// There are no PARAMETERS | |
async function f() { |