{"id":32256676,"url":"https://github.com/tinydesk/angular-observe","last_synced_at":"2026-02-21T08:01:29.394Z","repository":{"id":58239715,"uuid":"54557227","full_name":"tinydesk/angular-observe","owner":"tinydesk","description":"Observe properties on arbitrary javascript objects, similar to the $watch mechanism but more efficient.","archived":false,"fork":false,"pushed_at":"2016-04-14T14:40:54.000Z","size":15,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-23T15:50:34.856Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/tinydesk.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}},"created_at":"2016-03-23T12:15:35.000Z","updated_at":"2017-03-04T09:03:27.000Z","dependencies_parsed_at":"2022-08-31T00:02:08.546Z","dependency_job_id":null,"html_url":"https://github.com/tinydesk/angular-observe","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tinydesk/angular-observe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinydesk%2Fangular-observe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinydesk%2Fangular-observe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinydesk%2Fangular-observe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinydesk%2Fangular-observe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinydesk","download_url":"https://codeload.github.com/tinydesk/angular-observe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinydesk%2Fangular-observe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29676978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T06:23:40.028Z","status":"ssl_error","status_checked_at":"2026-02-21T06:23:39.222Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-10-22T19:06:42.104Z","updated_at":"2026-02-21T08:01:29.389Z","avatar_url":"https://github.com/tinydesk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://badge-size.herokuapp.com/tinydesk/angular-observe/master/dist/angular-observe.min.js.svg?compression=gzip\u0026label=minified)\n\n# angular-observe\n\nObserve properties on arbitrary javascript objects, similar to the $watch mechanism but more efficient.\n\n## Getting Started\n\nInstall bower dependency:\n```\nbower install angular-observe --save\n```\n\nAdd angular dependency:\n```javascript\nangular.module('app', ['tinydesk.observe']);\n```\n\nInject where needed:\n```javascript\n.factory('MyService', ['Observe', function(Observe) { ... }]);\n```\n\nWatch properties on objects:\n```javascript\nvar obj = {\n  x: 2,\n  y: 'name',\n  z: {\n    a: 1,\n    b: 2\n  }\n};\n\n// watch a single property\nObserve.property(obj, 'x', function(newValue, oldValue) {\n  console.log(newValue, oldValue);\n});\n\nobj.x = 3; // triggers callback\nobj = {...} // does not trigger callback\n\n// watch nested properties\nObserve.properties(obj, 'z.a', function() {\n  // does not support parameters at the moment\n  console.log(obj.z.a);\n});\n\nobj.z.a = 3; // triggers callback\nobj.z = { ... }; // triggers callback\n\n// watch multiple (nested) properties\nObserve.properties(obj, ['z.a', 'x'], function() {\n  console.log(obj.z.a + obj.x);\n});\n\nobj.z.a = 3; // triggers callback\nobj.z = {...}; // triggers callback\nobj.x = 2; // triggers callback\n\n// unregister properties by executing the corresponding callback\nvar unregister = Observe.property(obj, 'x', function(v) {\n  console.log(v);\n});\n\nobj.x = 2; // triggers callback\nunregister();\nobj.x = 4; // does not trigger callback\n\n```\n\n## Motivation\n\nAngularJS is a great framework for creating interactive client-side web applications. However, when screens get very complex, the number of watchers increases and performance degrades. This is especially true, when expressions are complicated and cannot be represented by a watch on a property but rather need to be evaluated on every tick. A common scenario where this might be encountered is hierarchical data. One has to choose between the two suboptimal options of either deeply watching the whole data structure, or executing functions on every digest, including the regular tick.\n\nThis library provides a solution to this problem while keeping a syntactic similarity to the watch paradigm. It has two major advantages, compared to `$watch`:\n\n- It does not need a `$scope` object to work. This means it can be used inside model objects to aggregate complex data whenever critical properties change. The aggregated data can then be accessed by angular via the normal watch mechanism.\n- It uses `Object.defineProperty` which is a native java script feature. The overhead introduced by watching a property is equal to the overhead introduced by using a setter on the property.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinydesk%2Fangular-observe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinydesk%2Fangular-observe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinydesk%2Fangular-observe/lists"}