{"id":20875904,"url":"https://github.com/saqqdy/untiljs","last_synced_at":"2026-02-18T17:02:22.548Z","repository":{"id":252753134,"uuid":"841358265","full_name":"saqqdy/untiljs","owner":"saqqdy","description":"Promised one-time watch for changes","archived":false,"fork":false,"pushed_at":"2024-10-28T06:36:20.000Z","size":755,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-29T09:06:16.146Z","etag":null,"topics":["until","until-done","untiljs","use-until","useuntil"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saqqdy.png","metadata":{"files":{"readme":"README-zh_CN.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["saqqdy"]}},"created_at":"2024-08-12T08:48:50.000Z","updated_at":"2024-10-22T11:04:34.000Z","dependencies_parsed_at":"2024-10-22T15:57:59.372Z","dependency_job_id":null,"html_url":"https://github.com/saqqdy/untiljs","commit_stats":null,"previous_names":["saqqdy/untiljs"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Funtiljs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Funtiljs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Funtiljs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saqqdy%2Funtiljs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saqqdy","download_url":"https://codeload.github.com/saqqdy/untiljs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225141030,"owners_count":17427206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["until","until-done","untiljs","use-until","useuntil"],"created_at":"2024-11-18T06:49:02.896Z","updated_at":"2026-02-18T17:02:17.490Z","avatar_url":"https://github.com/saqqdy.png","language":"TypeScript","readme":"\u003cdiv style=\"text-align: center;\" align=\"center\"\u003e\n\n# untiljs\n\nPromise观察一次性变化\n\n[![NPM version][npm-image]][npm-url]\n[![Codacy Badge][codacy-image]][codacy-url]\n[![tree shaking][tree-shaking-image]][tree-shaking-url]\n![typescript][typescript-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n[![gzip][gzip-image]][gzip-url]\n[![License][license-image]][license-url]\n\n[![Sonar][sonar-image]][sonar-url]\n\n\u003c/div\u003e\n\n\u003cdiv style=\"text-align: center; margin-bottom: 20px;\" align=\"center\"\u003e\n\n### **[API 文档](https://www.saqqdy.com/untiljs)** • **[更新日志](./CHANGELOG.md)**\n\n**使用其他语言阅读：[English](./README.md) | 简体中文**\n\n\u003c/div\u003e\n\n## 体验\n\n在线体验 untiljs 功能 [Edit in CodeSandbox](https://codesandbox.io/p/sandbox/github/saqqdy/untiljs/tree/master/examples)\n\n## 安装\n\n```bash\n# 使用pnpm\n$ pnpm install untiljs\n\n# 使用npm\n$ npm install untiljs --save\n\n# 使用 yarn\n$ yarn add untiljs\n```\n\n## 使用\n\n### 1. 等待异步数据加载完成\n\n```ts\nimport { ref } from 'vue'\nimport until from 'untiljs'\n\nconst val = ref(1)\n\nsetTimeout(() =\u003e {\n  val.value = 2\n}, 1000)\n;(async () =\u003e {\n  await until(val).toBe(2)\n  // state is now ready\n})()\n```\n\n### 2. 自定义表达式\n\n```ts\nimport { ref } from 'vue'\nimport until from 'untiljs'\n\nconst val = ref(1)\n\nsetTimeout(() =\u003e {\n  val.value = 2\n}, 1000)\n;(async () =\u003e {\n  await until(val).toMatch(value =\u003e value \u003e 1)\n  // state is now ready\n})()\n```\n\n### 3. 等待直到超时\n\n```ts\nimport { ref } from 'vue'\nimport until from 'untiljs'\n\nconst val = ref(1)\n\nsetTimeout(() =\u003e {\n  val.value = 2\n}, 1000)\n;(async () =\u003e {\n  await until(val).not.toBe(ref(2), { timeout: 500, throwOnTimeout: true })\n  // reject timeout\n})()\n```\n\n### 4. 更多示例\n\n```ts\nimport { ref } from 'vue'\nimport until from 'untiljs'\n\nconst val = ref(1)\n\nsetTimeout(() =\u003e {\n  val.value = 2\n}, 1000)\n;(async () =\u003e {\n  await until(ref).toBe(true)\n  await until(ref).toMatch(v =\u003e v \u003e 5 \u0026\u0026 v \u003c 10)\n  await until(ref).changed()\n  await until(ref).changedTimes(2)\n  await until(ref).toBeTruthy()\n  await until(ref).toBeNull()\n\n  await until(ref).not.toBeNull()\n  await until(ref).not.toBeTruthy()\n})()\n```\n\n## 使用 unpkg CDN\n\n```html\n\u003cscript src=\"https://unpkg.com/vue-demi@latest/lib/index.iife.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/untiljs@latest/dist/index.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  await until(val).toBe(true)\n  // ...\n\u003c/script\u003e\n```\n\n## 问题和支持\n\nPlease open an issue [here](https://github.com/saqqdy/untiljs/issues).\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/untiljs.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/untiljs\n[codacy-image]: https://app.codacy.com/project/badge/Grade/f70d4880e4ad4f40aa970eb9ee9d0696\n[codacy-url]: https://www.codacy.com/gh/saqqdy/untiljs/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=saqqdy/untiljs\u0026utm_campaign=Badge_Grade\n[tree-shaking-image]: https://badgen.net/bundlephobia/tree-shaking/untiljs\n[tree-shaking-url]: https://bundlephobia.com/package/untiljs\n[typescript-url]: https://badgen.net/badge/icon/typescript?icon=typescript\u0026label\n[codecov-image]: https://img.shields.io/codecov/c/github/saqqdy/untiljs.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/saqqdy/untiljs?branch=master\n[download-image]: https://img.shields.io/npm/dm/untiljs.svg?style=flat-square\n[download-url]: https://npmjs.org/package/untiljs\n[gzip-image]: http://img.badgesize.io/https://unpkg.com/untiljs/dist/index.min.js?compression=gzip\u0026label=gzip%20size:%20JS\n[gzip-url]: http://img.badgesize.io/https://unpkg.com/untiljs/dist/index.min.js?compression=gzip\u0026label=gzip%20size:%20JS\n[license-image]: https://img.shields.io/badge/License-MIT-blue.svg\n[license-url]: LICENSE\n[sonar-image]: https://sonarcloud.io/api/project_badges/quality_gate?project=saqqdy_untiljs\n[sonar-url]: https://sonarcloud.io/dashboard?id=saqqdy_untiljs\n","funding_links":["https://github.com/sponsors/saqqdy"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaqqdy%2Funtiljs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaqqdy%2Funtiljs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaqqdy%2Funtiljs/lists"}