{"_id":"@appstrophe/ngx-computeasync","_rev":"8-f8e126f7630224b99f1ce74e1bef169c","name":"@appstrophe/ngx-computeasync","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.1":{"name":"@appstrophe/ngx-computeasync","version":"0.0.1","peerDependencies":{"@angular/common":"^17.0.0","@angular/core":"^17.0.0"},"dependencies":{"tslib":"^2.3.0"},"sideEffects":false,"module":"fesm2022/appstrophe-ngx-computeasync.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/appstrophe-ngx-computeasync.mjs","esm":"./esm2022/appstrophe-ngx-computeasync.mjs","default":"./fesm2022/appstrophe-ngx-computeasync.mjs"}},"_id":"@appstrophe/ngx-computeasync@0.0.1","gitHead":"d118c8ee01c4312bfc0eedf582a6b8e79be43aae","description":"This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.0.0.","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-ZQS33ZOLR3Vc0Lv6R/7cW0Lz8IyvlffYcEEJnlxiRIChbsSwkoJLl7P+mheD+sV8amjS2wDwfcXzHTlKbx9IEw==","shasum":"f47532d5ca838122c3793eb55419851252eab294","tarball":"https://registry.npmjs.org/@appstrophe/ngx-computeasync/-/ngx-computeasync-0.0.1.tgz","fileCount":10,"unpackedSize":16293,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHZNM2rjqincjfdtgugfH3njniiCbVVu7CdtR25TqkS/AiBbi9SUPOM1L2Uae9UKJ/qMUWm4Jmyhcb3GfoIGXDWLEg=="}]},"_npmUser":{"name":"glsm4tt","email":"appstrophe@gmail.com"},"directories":{},"maintainers":[{"name":"glsm4tt","email":"appstrophe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-computeasync_0.0.1_1702754430347_0.4566718462523238"},"_hasShrinkwrap":false},"0.0.2":{"name":"@appstrophe/ngx-computeasync","version":"0.0.2","peerDependencies":{"@angular/common":"^17.0.0","@angular/core":"^17.0.0"},"dependencies":{"tslib":"^2.3.0"},"sideEffects":false,"module":"fesm2022/appstrophe-ngx-computeasync.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/appstrophe-ngx-computeasync.mjs","esm":"./esm2022/appstrophe-ngx-computeasync.mjs","default":"./fesm2022/appstrophe-ngx-computeasync.mjs"}},"_id":"@appstrophe/ngx-computeasync@0.0.2","gitHead":"320ff88c0268147692b5d723126928f1a978641f","description":"## Documentation","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-ZDs42bh7ag53O5s83D0Qfos6RmeZZq+g8Jk+jBiFQ/OyPD+SQQHFEWTuNw4LIZuLnQfUJ/Wp3v+W23TMDOzD7A==","shasum":"cec9e817cd3a0c4039af30adf61f6bbe85201bc3","tarball":"https://registry.npmjs.org/@appstrophe/ngx-computeasync/-/ngx-computeasync-0.0.2.tgz","fileCount":10,"unpackedSize":17878,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjAQo0ELudy9fFO4P9OrW39IoVonpdQnntV1NG8M9R9gIgf+zvmSrTFUyspa9gV6/bK10rKi19jMojkEjFE+li/uc="}]},"_npmUser":{"name":"glsm4tt","email":"appstrophe@gmail.com"},"directories":{},"maintainers":[{"name":"glsm4tt","email":"appstrophe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-computeasync_0.0.2_1702755116332_0.3248667581264566"},"_hasShrinkwrap":false},"0.0.3":{"name":"@appstrophe/ngx-computeasync","version":"0.0.3","description":"Computed for async functions","repository":{"type":"git","url":"git+https://github.com/glsm4tt/ngx-utilities.git"},"homepage":"https://github.com/glsm4tt/ngx-utilities/tree/main/projects/ngx-computeasync","peerDependencies":{"@angular/common":"^17.0.0","@angular/core":"^17.0.0"},"dependencies":{"tslib":"^2.3.0"},"sideEffects":false,"module":"fesm2022/appstrophe-ngx-computeasync.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/appstrophe-ngx-computeasync.mjs","esm":"./esm2022/appstrophe-ngx-computeasync.mjs","default":"./fesm2022/appstrophe-ngx-computeasync.mjs"}},"_id":"@appstrophe/ngx-computeasync@0.0.3","gitHead":"8920f0dfc5aac5ba3119175a29fbae3e75d36456","bugs":{"url":"https://github.com/glsm4tt/ngx-utilities/issues"},"_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-8+XxBmScjMRH6RDaxFrZd9xdg/zOBhR61ng3JesHGP/fuBrJq52MeXnJoksRgc9AQaoqWbuuBq4IjKF9odsf3g==","shasum":"34acc7d930a8f33112f6ec23a893dae7f7aee3c5","tarball":"https://registry.npmjs.org/@appstrophe/ngx-computeasync/-/ngx-computeasync-0.0.3.tgz","fileCount":10,"unpackedSize":17788,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD4KJfLh9d7bcf8YuWSf7n6H+BIrMl4OPXZLTDtxmv25QIhAM03zj3+3DgZNuZT25jMtI8bOvv5aOTMPksjaRvzS7fV"}]},"_npmUser":{"name":"glsm4tt","email":"appstrophe@gmail.com"},"directories":{},"maintainers":[{"name":"glsm4tt","email":"appstrophe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-computeasync_0.0.3_1702756482121_0.08581326296697722"},"_hasShrinkwrap":false},"0.0.4":{"name":"@appstrophe/ngx-computeasync","version":"0.0.4","description":"Computed for async functions","repository":{"type":"git","url":"git+https://github.com/glsm4tt/ngx-utilities.git"},"homepage":"https://github.com/glsm4tt/ngx-utilities/tree/main/projects/ngx-computeasync","peerDependencies":{"@angular/common":"^17.0.0","@angular/core":"^17.0.0"},"dependencies":{"tslib":"^2.3.0"},"sideEffects":false,"module":"fesm2022/appstrophe-ngx-computeasync.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/appstrophe-ngx-computeasync.mjs","esm":"./esm2022/appstrophe-ngx-computeasync.mjs","default":"./fesm2022/appstrophe-ngx-computeasync.mjs"}},"_id":"@appstrophe/ngx-computeasync@0.0.4","gitHead":"fffdd16490c884587ed064092ef67500a42bbdba","bugs":{"url":"https://github.com/glsm4tt/ngx-utilities/issues"},"_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-tdEMVQxw25I6UhpKWXFlF7/K7kokTpGImhPjyz/Yx625pA7E8fniD0mM0aoXVjgjm0wwNEiL3FahLy07dPgFhg==","shasum":"9ecd3f01a4c0912362f9dd2f2ec0f6e596e1fe0b","tarball":"https://registry.npmjs.org/@appstrophe/ngx-computeasync/-/ngx-computeasync-0.0.4.tgz","fileCount":10,"unpackedSize":22617,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAD6u9qfIN0PIED7iV/paTz9QeIu0WZ8npS85jDryCNzAiEA2taIJZaHrD0aotOyltMkAkIUBtDk9j2UVuiTa3fpYoo="}]},"_npmUser":{"name":"glsm4tt","email":"appstrophe@gmail.com"},"directories":{},"maintainers":[{"name":"glsm4tt","email":"appstrophe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-computeasync_0.0.4_1702990068747_0.3078306665840269"},"_hasShrinkwrap":false},"0.0.5":{"name":"@appstrophe/ngx-computeasync","version":"0.0.5","description":"Computed for async functions","repository":{"type":"git","url":"git+https://github.com/glsm4tt/ngx-utilities.git"},"homepage":"https://github.com/glsm4tt/ngx-utilities/tree/main/projects/ngx-computeasync","peerDependencies":{"@angular/common":"^17.0.0","@angular/core":"^17.0.0"},"dependencies":{"tslib":"^2.3.0"},"author":{"name":"Appstrophe Authors"},"license":"MIT","sideEffects":false,"module":"fesm2022/appstrophe-ngx-computeasync.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/appstrophe-ngx-computeasync.mjs","esm":"./esm2022/appstrophe-ngx-computeasync.mjs","default":"./fesm2022/appstrophe-ngx-computeasync.mjs"}},"_id":"@appstrophe/ngx-computeasync@0.0.5","gitHead":"648ec6c710b78bf1cccd0b51f8f886d8409dd662","bugs":{"url":"https://github.com/glsm4tt/ngx-utilities/issues"},"_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-X2b4hTZZSijfA2JMmkamFf0rp+C/Zw9xLNt6kUhjIa2G3ok9YrJcnDaWBopwMzyKb5iDgLzx8L9gUOEZWgZmVg==","shasum":"6973e9e7cfb1d9e04375fa319a9698b88a153a25","tarball":"https://registry.npmjs.org/@appstrophe/ngx-computeasync/-/ngx-computeasync-0.0.5.tgz","fileCount":10,"unpackedSize":22671,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD3Ev2PUrKAiDYDj+Z6AM6/VOomsT+IZxdC9DfUIOV6qAIgPXxGEb9TFuKR/XtZ2xzSTnANtLd+dZBl5AEMoQb69og="}]},"_npmUser":{"name":"glsm4tt","email":"appstrophe@gmail.com"},"directories":{},"maintainers":[{"name":"glsm4tt","email":"appstrophe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-computeasync_0.0.5_1702990562899_0.6371017591207602"},"_hasShrinkwrap":false},"0.0.6":{"name":"@appstrophe/ngx-computeasync","version":"0.0.6","description":"Computed for async functions","repository":{"type":"git","url":"git+https://github.com/glsm4tt/ngx-utilities.git"},"homepage":"https://github.com/glsm4tt/ngx-utilities/tree/main/projects/ngx-computeasync","peerDependencies":{"@angular/common":"^17.0.0","@angular/core":"^17.0.0"},"dependencies":{"tslib":"^2.3.0"},"author":{"name":"Appstrophe Authors"},"license":"MIT","sideEffects":false,"module":"fesm2022/appstrophe-ngx-computeasync.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/appstrophe-ngx-computeasync.mjs","esm":"./esm2022/appstrophe-ngx-computeasync.mjs","default":"./fesm2022/appstrophe-ngx-computeasync.mjs"}},"_id":"@appstrophe/ngx-computeasync@0.0.6","gitHead":"8cf99f11cefca7c1e3a4a3b742662c25be1737ae","bugs":{"url":"https://github.com/glsm4tt/ngx-utilities/issues"},"_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-hobLZX4QaFdvVnQ9/V+hZ/yLVtMrqcDnfZLFc9Gcut0I6+hZwJBHUzjgN5x2GL8RUCIjwZKbSuDvZAW3dij0sA==","shasum":"9646a563d551f13506154e117c7c7308f39c13bc","tarball":"https://registry.npmjs.org/@appstrophe/ngx-computeasync/-/ngx-computeasync-0.0.6.tgz","fileCount":10,"unpackedSize":22756,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7wu6t41yPCxxc+j+ztKd8Ja85Syv4noiVCksf+a4ZeQIhANmXBwj9UDpLXt7qqVvN6csc6aY7RJNk5sfAphqUSlxs"}]},"_npmUser":{"name":"glsm4tt","email":"appstrophe@gmail.com"},"directories":{},"maintainers":[{"name":"glsm4tt","email":"appstrophe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-computeasync_0.0.6_1703157225047_0.03089417064576816"},"_hasShrinkwrap":false},"0.0.7":{"name":"@appstrophe/ngx-computeasync","version":"0.0.7","description":"Computed for async functions","repository":{"type":"git","url":"git+https://github.com/glsm4tt/ngx-utilities.git"},"homepage":"https://github.com/glsm4tt/ngx-utilities/tree/main/projects/ngx-computeasync","peerDependencies":{"@angular/common":"^17.0.0","@angular/core":"^17.0.0"},"dependencies":{"tslib":"^2.3.0"},"author":{"name":"Appstrophe Authors"},"license":"MIT","sideEffects":false,"module":"fesm2022/appstrophe-ngx-computeasync.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/appstrophe-ngx-computeasync.mjs","esm":"./esm2022/appstrophe-ngx-computeasync.mjs","default":"./fesm2022/appstrophe-ngx-computeasync.mjs"}},"_id":"@appstrophe/ngx-computeasync@0.0.7","gitHead":"4eea6618a46d91721db94bb2171dce8c61503c8d","bugs":{"url":"https://github.com/glsm4tt/ngx-utilities/issues"},"_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-oHfSdS7JrOrMaAzZTcCfAh099ULYJhoc9ZvkWJ3edujzTsFIGg7oyJjoCqtz7SpRbPHq5DWFxS+X65p9cHHlqQ==","shasum":"cbbda27c4914190a67269bc5a759bafd3cbf201a","tarball":"https://registry.npmjs.org/@appstrophe/ngx-computeasync/-/ngx-computeasync-0.0.7.tgz","fileCount":10,"unpackedSize":22902,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClD8o4WUj0RbF4NNtlJ0VAzYKazJFteA+I3O42asZJyQIgS3VoO4v5L7Eq2858NCd4sjgPSkLm8+gKeDPusY7+DfY="}]},"_npmUser":{"name":"glsm4tt","email":"appstrophe@gmail.com"},"directories":{},"maintainers":[{"name":"glsm4tt","email":"appstrophe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-computeasync_0.0.7_1703158153508_0.9065004263548195"},"_hasShrinkwrap":false}},"time":{"created":"2023-12-16T19:20:30.223Z","0.0.1":"2023-12-16T19:20:30.529Z","modified":"2023-12-21T11:29:13.840Z","0.0.2":"2023-12-16T19:31:56.506Z","0.0.3":"2023-12-16T19:54:42.285Z","0.0.4":"2023-12-19T12:47:48.980Z","0.0.5":"2023-12-19T12:56:03.137Z","0.0.6":"2023-12-21T11:13:45.243Z","0.0.7":"2023-12-21T11:29:13.652Z"},"maintainers":[{"name":"glsm4tt","email":"appstrophe@gmail.com"}],"description":"Computed for async functions","readme":"# ngx-computeasync\n\nComputed for async functions\n\n## Installation\n\nUsing npm:\n```shell\nnpm i @appstrophe/ngx-computeasync\n```\n\nUsing yarn:\n```shell\nyarn add @appstrophe/ngx-computeasync\n```\n\n## Usage\n\n``` typescript\nimport { Component, inject, signal } from '@angular/core'\nimport { computedAsync } from '@appstrophe/ngx-computeasync'\n\n@Component({\n  selector: 'app-test',\n  template: `<p>{{ product() }}</p>`\n})\nexport class TestComponent {\n  productService = inject(ProductService);\n  productId = signal(1);\n\n  product = computedAsync(() => this.productService.getAsyncProduct(this.productId()));\n}\n```\n\n`computedAsync` allows you to get a computed `Signal` from async content.\n\nThe content can either return a `Promise`\nand rxjs `Observable` or a synchronous value.\n\n``` typescript\nimport { computedAsync } from '@appstrophe/ngx-computeasync'\n\nnumberSignal = signal(1);\n\n// from Observable\nfunction double$ = (value: number) => of(value).pipe(delay(500), map(value => value * 2));\ncomputedFromObservable = computedAsync(() => double$(this.numberSignal()));\n\n// from Promise\nfunction asyncDouble = (value: number) => new Promise(resolve => setTimeout(() => value * 2, 500));\ncomputedFromPromise = computedAsync(() => asyncDouble(this.numberSignal()));\n\n// or synchronous\nfunction double = (value: number) => value * 2;\ncomputedNumber = computedAsync(() => double(this.numberSignal()));\n```\n\n### Initial value\n\nFor async function, you can set a default value that will be immediately returned before the async value to be pushed.\n\n``` typescript\nimport { computedAsync } from '@appstrophe/ngx-computeasync'\n\nproductId = signal(1);\n\nfunction product$ = (productId: number) => this.http.get<Config>(`productUrl/${productId}`);\n\ncomputedFromObservable = computedAsync(() => product$(this.productId()),\n{ initialValue: new Product() });\n```\n\n### Evaluation State\n\nYou will need to pass a `WritableSignal` or a `BehaviorSubject` to track if the async function is evaluating.\n\n``` typescript\nimport { computedAsync } from '@appstrophe/ngx-computeasync'\n\nevaluating = signal(false);\n\nevaluatingEffect = effect(() => console.log(`Get product server call completed: ${this.evaluating()}`))\n\nproductId = signal(1);\n\nfunction product$ = (productId: number) => this.http.get<Config>(`productUrl/${productId}`);\n\ncomputedFromObservable = computedAsync(() => product$(this.productId()),\n{ evaluating });\n```\n\n### Playground\n\n[Stackblitz playground](https://stackblitz.com/edit/stackblitz-starters-nqf5mn?file=src%2Fmain.ts,package.json,src%2Findex.html)\n","readmeFilename":"README.md","homepage":"https://github.com/glsm4tt/ngx-utilities/tree/main/projects/ngx-computeasync","repository":{"type":"git","url":"git+https://github.com/glsm4tt/ngx-utilities.git"},"bugs":{"url":"https://github.com/glsm4tt/ngx-utilities/issues"},"author":{"name":"Appstrophe Authors"},"license":"MIT"}