Home / File/ client-password.js — astro Source File

client-password.js — astro Source File

Architecture documentation for client-password.js, a javascript file in the astro codebase.

Entity Profile

Source Code

// Hydrate when the user types the correct password
export default (load, options) => {
  const password = options.value
  let consecutiveMatch = 0

  const handleKeydown = async (e) => {
    if (e.key === password[consecutiveMatch]) {
      consecutiveMatch++
    } else {
      consecutiveMatch = 0
    }

    if (consecutiveMatch === password.length) {
      window.removeEventListener('keydown', handleKeydown)
      const hydrate = await load()
      await hydrate()
    }
  }
  
  window.addEventListener('keydown', handleKeydown)
}

Frequently Asked Questions

What does client-password.js do?
client-password.js is a source file in the astro codebase, written in javascript.
Where is client-password.js in the architecture?
client-password.js is located at packages/astro/e2e/fixtures/custom-client-directives/client-password.js (directory: packages/astro/e2e/fixtures/custom-client-directives).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free