{"id":"nazumah/async","name":"async","scope":"nazumah","platform":"roblox","description":"Mirrored from the Wally registry.","version":"1.0.4","latest":"1.0.4","versions":["0.1.0","0.1.1","1.0.0","1.0.1","1.0.2","1.0.3","1.0.4"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{},"integrity":"9aa87a71cb6833462e27b7d0641df2ffecc31ec4f751614973e1e160e525b11b","likes":0,"downloads":0,"install":"forest install nazumah/async","url":"https://forest.dev/p/roblox/nazumah/async","files":"https://api.forest.dev/ai/package/roblox/nazumah/async/files","readme":"# Async\n\n[![Wally](https://img.shields.io/badge/Wally-1.0.4-blue.svg)](https://wally.run/package/nazumah/async)\n[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n[![Luau](https://img.shields.io/badge/Luau-Strict-blueviolet.svg)](https://luau-lang.org/)\n\nAsync is a lightweight, high-performance Promise implementation for Luau on Roblox. It provides a robust architecture for handling asynchronous operations with full support for cancellation, chaining, and strict type safety.\n\n---\n\n## Key Features\n\n- **Extreme Type Safety**: Designed to be the standard networking and async primitive for Kernel. It uses explicit type exports to ensure IntelliSense is never lost during `require` operations.\n- **Robust Cancellation**: Built-in `onCancel` hooks allow for deep cleanup of ongoing tasks (e.g., stopping a data fetch or clearing a buffer).\n- **Collective Operations**: Native support for `Async.all`, `Async.race`, `Async.any`, and `Async.some` to manage multiple concurrent tasks.\n- **Thread Yielding**: Seamlessly transition between async chains and standard Luau threads using `:await()` or `:expect()`.\n\n---\n\n## Installation\n\n### Wally\nUpdate your `wally.toml`:\n\n```toml\n[dependencies]\nAsync = \"nazumah/async@1.0.4\"\n```\n\n---\n\n## Quick Start\n\n### 1. Basic Async Creation\n```lua\nlocal Async = require(path.to.Async)\n\nlocal function delayedMessage(msg: string)\n    return Async.new(function(resolve, reject)\n        task.wait(1)\n        resolve(msg)\n    end)\nend\n\ndelayedMessage(\"Hello World\"):andThen(print)\n```\n\n### 2. Handling Cancellation\n```lua\nlocal p = Async.new(function(resolve, reject, onCancel)\n    local thread = task.delay(5, resolve, \"Done\")\n    \n    onCancel(function()\n        task.cancel(thread)\n        print(\"Async was cancelled!\")\n    end)\nend)\n\np:cancel()\n```\n\n### 3. Usage inside Threads\n```lua\nlocal success, result = myAsync:await()\nif success then\n    print(\"Success:\", result)\nelse\n    warn(\"Failed:\", result)\nend\n```\n\n---\n\n## Documentation\n\n- [Why Use Async?](docs/WhyUseAsync.md)\n- [API Reference](docs/API.md)\n\n---\n\n## License\nLicensed under the [MIT](LICENSE) License.","readmeTruncated":false}