{"id":19249164,"url":"https://github.com/adbayb/lookat","last_synced_at":"2026-06-10T23:31:22.460Z","repository":{"id":89447023,"uuid":"289502162","full_name":"adbayb/lookat","owner":"adbayb","description":"📦 An observer/observable library","archived":false,"fork":false,"pushed_at":"2023-12-15T20:25:27.000Z","size":329,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T04:53:36.127Z","etag":null,"topics":["library"],"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/adbayb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2020-08-22T14:20:09.000Z","updated_at":"2023-11-27T17:05:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"b2aaacf5-30e2-4084-8423-16a8d865b587","html_url":"https://github.com/adbayb/lookat","commit_stats":{"total_commits":39,"total_committers":1,"mean_commits":39.0,"dds":0.0,"last_synced_commit":"a5352c59d15db89c8b09b6e68ed0a99c2f31422d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adbayb/lookat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adbayb%2Flookat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adbayb%2Flookat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adbayb%2Flookat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adbayb%2Flookat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adbayb","download_url":"https://codeload.github.com/adbayb/lookat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adbayb%2Flookat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34175887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["library"],"created_at":"2024-11-09T18:12:56.010Z","updated_at":"2026-06-10T23:31:22.444Z","avatar_url":"https://github.com/adbayb.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LookAt\n\nAn observer/observable library\n\n## API\n\n### Observable\n\nconst counter = observable(0); // returns counter.$ ($ is the reactive value accessor making the reactivity explicit in the naming). To mutate, use `counter.$++` for example\nconst person = observable({ firstname: \"Ayoub\", age: 28 }); // returns counter.\\$.age...\n\n### Observe\n\nconst voidValue = observe(() =\u003e console.log(counter \\* 2)); // side effects\nconst isPair = observe(() =\u003e counter % 2 === 0); // computed reactive value =\u003e returns observable value\nobserve(() =\u003e {\nconsole.log(isPair.\\$)\n})\n\n### Utilities\n\nunwrap(isPair) // returns raw value of an observable\n\n## TODO\n\n-   [x] Enable object like observable source\n-   [x] Enable Array observable source\n-   [ ] Enable Map observable source\n-   [ ] Enable Set observable source\n-   [x] Enable delete operator and other missing trap operators\n-   [x] Do not call observers if impacted value is not modified (check inside the setter trap)\n-   [x] Batch observer calls:\n    -   Avoid multiple same consecutive observable updates to trigger multiple observer calls (it should call one time):\n        const counter = observable(0);\n        const handleAdd = () =\u003e { \u003c- Should be batched\n        counter.$++;\n        counter.$++;\n        }\n        observe(() =\u003e {\n        counter.\\$ // \u003c- Should be called one time and not two\n        })\n    -   Optimize same observer calls if the side effect relies on computed observables\n        const counter = observable(0);\n        const counterSquare = observe(() =\u003e counter.$2);\n        observe(() =\u003e {\n        console.log(\"Counter Quatro = \", counter.$, \" \", counterSquare.\\$);\n        });\n        // =\u003e Currently, it's called two times since the observer relies on two observables but it could be improved with some predicates to be called once\n-   [ ] Performance/Memory benchmark\n-   [ ] Readme + Hosted documentation\n\n## Notes\n\n### Direct access via counter instead of counter.\\$ and non reactivity inside observe callback\n\n### API limitations and caveats with object like observable:\n\n👉 Updates are always notified from top to bottom. Updating a child property won't notify its parent observers. But a parent update (such a new reference through object affectation) will notify its child property observers. And it's quite natural and aligned with JS runtime:\n=\u003e value and reference are managed from top to bottom: a child cannot update its parent reference.\n\n👉 Parent update (eg. new object affectation) will notify its child observers if and only if all accessors to reach the targetted child property are specified inside the `observe` callback:\n\n❌ const state = person.$\n❌\tobserve(() =\u003e { state.firstName })\n❌\tperson.$ = { firstName: \"New\" }\n❌ // The observe callback won't be called\n\n✔️ observe(() =\u003e { person.$.firstName })\n✔️\tperson.$ = { firstName: \"New\" }\n✔️ // The observe callback will be called\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadbayb%2Flookat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadbayb%2Flookat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadbayb%2Flookat/lists"}