{
  "id": "fn-event-timeout",
  "dataComponent": "event",
  "heading": {
    "title": "timeout",
    "badges": ["Event", "PARTIAL", "Async"]
  },
  "synopsis": "Schedules a single-shot callback to run after a specified delay (in milliseconds). Supports partial usage with placeholders.",
  "codeBlocks": [
    "extend(\"event\")\n\n# Basic usage:\n# event:timeout(delayMS, callback)\n\n# Wait 1 second, then call slog(...) once.\nevent:timeout(1000, () => {\n  slog(\"One second elapsed!\")\n})\n\n# The callback is invoked exactly once.\n\n# Partial usage => fix the delay or callback ahead of time.\n\nset5s = event:timeout(5000)\nset5s(() => {\n  sput(\"5 seconds passed!\")\n})\n\n# Placeholder => known callback, missing delay:\nmyTimer = event:timeout(_, () => {\n  sput(\"Delay done.\")\n})\n\nmyTimer(2000)\n# => Waits 2 seconds, then calls sput(...)\n"
  ],
  "notes": [
    "Arguments: (delayMS, callback).",
    "- `delayMS`: an integer (or single-element IntArray) specifying how many milliseconds to wait.",
    "- `callback`: a function with no parameters, called once after the delay elapses.",
    "Returns `Bool(true)` or a success indicator if it schedules successfully. The task is automatically removed once it fires.",
    "Partial usage: If you only supply one argument, you get a partial function needing the missing argument. Use `_` placeholders to skip the first parameter if desired.",
    "This function is asynchronous; the script continues running while the timer counts down."
  ]
}
