How to use the username.then function in username

To help you get started, we’ve selected a few username examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MarshallOfSound / Google-Play-Music-Desktop-Player-UNOFFICIAL- / src / renderer / windows / GPMWebView / interface / generic / errorHandler.js View on Github external
Emitter.on('error', (event, details) => {
  username.then((name) => {
    window.showToast(TranslationProvider.query('message-uncaught-error'), false,
    TranslationProvider.query('message-uncaught-error-button'), '#E53935',
    (buttonEvent, toast) => {
      const title = `Uncaught Exception: ${details.error.message.split(/\n/g)[0].substring(0, 100)}`;
      const body = `
  An uncaught exception was reported.  %0A
  %23%23%23%23 Info:%0A
  **OS:** ${process.platform}%0A
  **Arch:** ${process.arch}%0A
  **GPMDP Version:** ${require('../../../../package.json').version}%0A
  **Time:** ${new Date()}%0A
  %0A
  %23%23%23%23 Error:%0A
  *${details.error.message.split(/\n/g)[0].substring(0, 100).replace(new RegExp(name, 'g'), '')}*%0A
  \`\`\`js%0A
  ${details.error.stack.replace(/(?:\r\n|\r|\n)/g, '%0A').substring(0, 1200).replace(new RegExp(name, 'g'), '')}
github GitSquared / edex-ui / src / _renderer.js View on Github external
<section style="opacity:0;" id="keyboard">
    </section>`;
    window.keyboard = new Keyboard({
        layout: path.join(keyboardsDir, settings.keyboard+".json"),
        container: "keyboard"
    });

    await _delay(10);

    document.getElementById("main_shell").setAttribute("style", "");

    await _delay(270);

    let greeter = document.getElementById("main_shell_greeting");

    require("username")().then(user =&gt; {
        greeter.innerHTML += `Welcome back, <em>${user}</em>`;
    }).catch(() =&gt; {
        greeter.innerHTML += "Welcome back";
    });
    greeter.setAttribute("style", "opacity: 1;");

    document.getElementById("filesystem").setAttribute("style", "");
    document.getElementById("keyboard").setAttribute("style", "");
    document.getElementById("keyboard").setAttribute("class", "animation_state_1");
    window.audioManager.keyboard.play();

    await _delay(100);

    document.getElementById("keyboard").setAttribute("class", "animation_state_1 animation_state_2");

    await _delay(1000);

username

Get the username of the current user

MIT
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis