Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgqfrms-GitHub/b252342f28497eadc96134a5873814fb to your computer and use it in GitHub Desktop.
Save xgqfrms-GitHub/b252342f28497eadc96134a5873814fb to your computer and use it in GitHub Desktop.
fetch & IIFE & ES6 & return undefined

fetch & IIFE & ES6 & return undefined

    
// IIFE & return


let nct = ((username=`xgqfrms-GitHub`, repo=`Node-CLI-Tools`) => {
    fetch(`https://api.github.com/repos/${username}/${repo}/commits`,{
        data: {
            client_id: '08ecc2f68d922f18800e',
            client_secret: '5846d428b5340812b76c9637eceaee979340b922'
        }
    })
    .then((response) => response.json())
    .then((json)=> {
        return repos = json;
    })
    .then((repos)=>{
        console.log(repos);
    });
})();

// undefined


let new_nct = ((username=`xgqfrms-GitHub`, repo=`Node-CLI-Tools`) => {
    fetch(`https://api.github.com/repos/${username}/${repo}/commits`,{
        data: {
            client_id: '08ecc2f68d922f18800e',
            client_secret: '5846d428b5340812b76c9637eceaee979340b922'
        }
    })
    .then((response) => response.json())
    .then((json)=> {
        return repos = json;
    })
    .then((repos)=>{
        console.log(repos);
        return new_nct = repos;
    });
})();

// new_nct
// repos


((username=`xgqfrms-GitHub`, repo=`Node-CLI-Tools`) => {
    fetch(`https://api.github.com/repos/${username}/${repo}/commits`,{
        data: {
            client_id: '08ecc2f68d922f18800e',
            client_secret: '5846d428b5340812b76c9637eceaee979340b922'
        }
    })
    .then((response) => response.json())
    .then((json)=> {
        return repos = json;
    });
})();

// repos
@xgqfrms
Copy link

xgqfrms commented Feb 7, 2022

microsoft/TypeScript-Website#2256

(() => {
  const tryLinks = document.querySelectorAll(`[class="playground-link"]`);
  for (let item of tryLinks) {
    item.target = "_blank";
  }
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment