{"id":21935946,"url":"https://github.com/portomartin/npmMutableLiveData","last_synced_at":"2025-07-22T02:31:11.813Z","repository":{"id":265163181,"uuid":"895317285","full_name":"MoaLaiSkirulais/npmMutableLiveData","owner":"MoaLaiSkirulais","description":"Java like LiveData pattern","archived":false,"fork":false,"pushed_at":"2024-11-28T01:50:31.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-28T02:32:48.526Z","etag":null,"topics":["angular","java","livedata","mutablelivedata"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MoaLaiSkirulais.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-11-28T01:25:33.000Z","updated_at":"2024-11-28T01:50:34.000Z","dependencies_parsed_at":"2024-11-28T02:32:59.731Z","dependency_job_id":"398fb351-c479-4f68-a5fa-2a81a8c3acb5","html_url":"https://github.com/MoaLaiSkirulais/npmMutableLiveData","commit_stats":null,"previous_names":["moalaiskirulais/npmmutablelivedata"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoaLaiSkirulais%2FnpmMutableLiveData","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoaLaiSkirulais%2FnpmMutableLiveData/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoaLaiSkirulais%2FnpmMutableLiveData/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoaLaiSkirulais%2FnpmMutableLiveData/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MoaLaiSkirulais","download_url":"https://codeload.github.com/MoaLaiSkirulais/npmMutableLiveData/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227017793,"owners_count":17717797,"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":["angular","java","livedata","mutablelivedata"],"created_at":"2024-11-29T01:12:28.721Z","updated_at":"2025-07-22T02:31:06.516Z","avatar_url":"https://github.com/MoaLaiSkirulais.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example\r\n\r\n## Animal class\r\n```typescript\r\n/* nosense class just for the next example */\r\nexport class Animal {\r\n\r\n\t name: string;\r\n\t race: string;\r\n\t  age: number;\r\n\t \r\n\tconstructor() {\r\n\r\n\t\tthis.name = \"Tom\";\r\n\t\tthis.race = \"Cat\";\r\n\t\tthis.age = 10;\r\n\t}\r\n}\r\n```\r\n\r\n## AppComponent\r\n```typescript\r\nimport { Component } from '@angular/core';\r\nimport { NgFor } from '@angular/common';\r\nimport { Animal } from '../class/Animal.class';\r\nimport {MutableLiveData} from 'mutable-live-data'\r\n\r\n@Component({\r\n\tselector: 'app-root',\r\n\timports: [NgFor],\r\n\ttemplateUrl: './app.component.html',\r\n\tstyleUrl: './app.component.css'\r\n})\r\n\r\nexport class AppComponent {\r\n\r\n\tanimalA: MutableLiveData\u003cAnimal\u003e;\r\n\tanimalB: Animal;\r\n\r\n\tanimalsA: MutableLiveData\u003cArray\u003cAnimal\u003e\u003e;\r\n\tanimalsB: Array\u003cAnimal\u003e;\r\n\r\n\tconstructor() {\r\n\r\n\t\t/* observing a plain class */\r\n\t\tthis.animalA = new MutableLiveData(Animal);\r\n\t\tthis.animalB = new Animal();\r\n\r\n\t\tthis.animalA.observe(() =\u003e { \r\n\t\t\tthis.animalB = this.animalA.getValue();\r\n\t\t});\r\n\r\n\t\t/* observing array of same plain class */\r\n\t\tthis.animalsA = new MutableLiveData(Array\u003cAnimal\u003e);\r\n\t\tthis.animalsB = new Array\u003cAnimal\u003e();\r\n\r\n\t\tthis.animalsA.observe(() =\u003e { \r\n\t\t\tthis.animalsB = this.animalsA.getValue();\r\n\t\t});\t\t\r\n\t}\r\n\r\n\tchangeAnimal() {\r\n\r\n\t\tvar animal: Animal = this.animalA.getValue();\r\n\t\tanimal.name = \"Tim\";\r\n\t\tanimal.race = \"Horse\";\r\n\t\tanimal.age = 25;\r\n\t\tthis.animalA.postValue(animal);\r\n\r\n\t\tvar animals : Array\u003cAnimal\u003e = this.animalsA.getValue();\r\n\t\tanimals.push(animal)\r\n\t\tthis.animalsA.postValue(animals)\r\n\t}\r\n}\r\n```\r\n\r\n## html\r\n```html\r\n\u003ch1\u003eAngular Mutable LiveData\u003c/h1\u003e\r\n\r\n\u003ch2\u003eAnimal\u003c/h2\u003e\r\n\u003cp\u003eName: {{animalB.name}}\u003c/p\u003e\r\n\u003cp\u003eRace: {{animalB.race}}\u003c/p\u003e\r\n\u003cp\u003eAge: {{animalB.age}}\u003c/p\u003e\r\n\r\n\u003ch2\u003eAnimals\u003c/h2\u003e\r\n\u003cp\u003e{{animalsB}}\u003c/p\u003e\r\n\r\n\u003cli\u003e\r\n\t\u003cul *ngFor=\"let animal of animalsB\"\u003e\r\n\r\n\t\t{{animal.name}}\r\n\t\u003c/ul\u003e\r\n\u003c/li\u003e\r\n\r\n\u003cbutton (click)=\"changeAnimal()\"\u003eChange Animal\u003c/button\u003e\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportomartin%2FnpmMutableLiveData","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fportomartin%2FnpmMutableLiveData","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportomartin%2FnpmMutableLiveData/lists"}