{"id":19874434,"url":"https://github.com/strongloop/angular-live-set","last_synced_at":"2025-10-23T18:35:37.970Z","repository":{"id":34076136,"uuid":"37879348","full_name":"strongloop/angular-live-set","owner":"strongloop","description":"Build realtime angular apps with html5's Server Sent Events","archived":false,"fork":false,"pushed_at":"2020-02-10T16:41:27.000Z","size":905,"stargazers_count":101,"open_issues_count":0,"forks_count":17,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-04-07T01:05:14.960Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"bradtraversy/babel_webpack_starter","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strongloop.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":"CODEOWNERS","security":null,"support":null}},"created_at":"2015-06-22T20:37:26.000Z","updated_at":"2024-04-15T20:47:25.000Z","dependencies_parsed_at":"2022-07-17T20:41:38.096Z","dependency_job_id":null,"html_url":"https://github.com/strongloop/angular-live-set","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fangular-live-set","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fangular-live-set/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fangular-live-set/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fangular-live-set/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strongloop","download_url":"https://codeload.github.com/strongloop/angular-live-set/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252023227,"owners_count":21682146,"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":[],"created_at":"2024-11-12T16:23:18.820Z","updated_at":"2025-10-23T18:35:32.898Z","avatar_url":"https://github.com/strongloop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular Live Set\n\nDisplay changes as they are made to a collection of objects.\n\n[**View the examples**](https://github.com/strongloop/angular-live-set-example)\n\n## Requirements\n\n - AngularJS\n - `ChangeStream` server (eg. LoopBack)\n\n## Use\n\nInstall Angular Live Set with [Bower](http://bower.io/):\n\n```sh\nbower install angular-live-set\n```\n\nThis will copy the `angular-live-set` files into a `bower_components` folder, along with its dependencies. Load the script files in your application:\n\n```html\n\u003cscript type=\"text/javascript\" src=\"bower_components/angular/angular.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"bower_components/angular-live-set/angular-live-set.js\"\u003e\u003c/script\u003e\n```\n\nAdd the module to your dependencies:\n\n```javascript\nangular.module('myApp', ['ls.LiveSet', 'ls.ChangeStream'])\n```\n## Concurrency\n\n`Change` streams are applied in order. This means the set can only be modified synchronously. The last change wins.\n\n## API\n\n### LiveSet(data, changes, options)\n\nA `LiveSet` applies a `ChangeStream`, or a continuous stream of changes, to an array of objects. The set itself is **read only** and can only be modified by sending a change through the change stream.\n\n**Note:** Updates to the `LiveSet` will trigger a `$rootScope.$apply()`.\n\n**data**\n\nAn `Array` of initial data.\n\n**changes**\n\nA `ChangeStream` to be applied continuously to the set.\n\n**options**\n\nCustomize the `LiveSet`.\n\n**options.id**\n\nA `String` defining the **id** property for objects in the set. Default: `'id'`.\n\n**Example**\n\n```js\n// objects in the set must include some identifying property (customizable)\nvar data = [{id: 1, val: 'foo'}, {id: 2, val: 'bar'}];\nvar src = new EventSource('/changes');\nvar changes = createChangeStream(src);\nvar set = new LiveSet(data, changes);\n\n// bind to the set from a template\n// like you would an array\n// note: the data in the array will be updated\n// changes come in (from the ChangeStream)\n$scope.values = set.toLiveArray();\n```\n\n### ChangeStream(eventSource)\n\n```js\nfunction MyController($scope, createChangeStream) {\n  // create a change stream\n  var changes = createChangeStream();\n}\n```\n\n**eventSource**\n\nAn `EventSource` emitting the following events:\n\n - `data` - contains a `Change` object\n - `error` - contains an `Error` object\n - `end` - the stream has ended on the server\n\nA continuous stream of `Change` objects. Each `Change` represents a modification to an object. Changes are applied to a set in the order they flow in the stream.\n\n### Change\n\nA chunk in a `ChangeStream`.\n\n**change.target**\n\nThis change applies to an object with this identifier.\n\n**change.type**\n\n - `create`\n - `update`\n - `remove`\n\n**change.data**\n\n - `create` - the entire object\n - `update` - the entire object\n - `remove` - `null`\n\n**change.optimistic**\n\n`true` when a change is likely to be made, but has not completed.\n\n**Only supported for changes of type `update` and `remove`.**\n\nA change has not been made to an object, but it has a very high likelyhood of being made. For example, a user modifies data locally and sends it to a server. This change\nhas not actually been made to the definitave state on the server. Unless\nsomething unexpected happens, the change will be made and sent through a `ChangeStream`.\n\nIn cases like this, it is appropriate to send an \"optimistic\" change that will be\nimmediately applied. These changes should be reverted after a specified period unless\nanother (non-optmisitic) change with the same target is written to the `ChangeStream`.\n\n### Error\n\n**error.message**\n\nAn error message.\n\n**error.status**\n\nAn HTTP-like status code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrongloop%2Fangular-live-set","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrongloop%2Fangular-live-set","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrongloop%2Fangular-live-set/lists"}