{"id":24379683,"url":"https://github.com/y-js/y-map","last_synced_at":"2025-10-24T00:31:43.423Z","repository":{"id":58228980,"uuid":"47268998","full_name":"y-js/y-map","owner":"y-js","description":"Map type for Yjs","archived":false,"fork":false,"pushed_at":"2017-10-06T21:50:21.000Z","size":210,"stargazers_count":14,"open_issues_count":4,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-10T21:09:55.365Z","etag":null,"topics":["yjs","yjs-type"],"latest_commit_sha":null,"homepage":"http://y-js.org","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/y-js.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":"2015-12-02T15:12:40.000Z","updated_at":"2018-09-25T02:30:42.000Z","dependencies_parsed_at":"2022-08-31T09:20:51.420Z","dependency_job_id":null,"html_url":"https://github.com/y-js/y-map","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/y-js","download_url":"https://codeload.github.com/y-js/y-map/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248298321,"owners_count":21080320,"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":["yjs","yjs-type"],"created_at":"2025-01-19T07:18:45.158Z","updated_at":"2025-10-24T00:31:38.383Z","avatar_url":"https://github.com/y-js.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Map Type for [Yjs](https://github.com/y-js/yjs)\n\nManage map-like data with this shareable map type. You can insert and delete objects in y-map. The objects must either be a custom types, or fulfill the following property: `v equals JSON.parse(JSON.stringify(v))` (according to your definition of equality)\n\n## Use it!\nRetrieve this with bower or npm.\n\n##### Bower\n```\nbower install y-map --save\n```\n\n##### NPM\n```\nnpm install y-map --save\n```\n\n# Y.Map\nY.Map mimics the behaviour of a javascript Object. You can create, update, and remove properies on this type. Furthermore, you can observe changes on this type as you can observe changes on Javascript Objects with [Object.observe](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe) - an ECMAScript 7 proposal ~~which is likely to become accepted by the committee~~. Until then, we have our own implementation.\n\n##### Reference\n* .get(key)\n  * Retrieve the value for key\n* .set(key, value)\n  * Set/update a property\n  * You can also insert a type `map.set(key, Y.Map)`\n  * If not a shared type, the value should fulfill the following property: `value equals JSON.parse(JSON.stringify(value))` (according to your notion of equality)\n* .delete(key)\n  * Delete a property\n* .keys()\n  * Returns all keys for all values\n* .observe(observer)\n  * The `observer` is called whenever something on this object changes. Throws *add*, *update*, and *delete* events\n  * The `event` object has the following properties:\n    * `event.type` The type of the event. \"add\" - a new key-value pair was added, \"update\" - an existing key-value pair was changed, or \"delete\" - a key-value pair was deleted)\n    * `event.name` The key of the changed property\n    * `event.value` If event type is either \"update\" or \"add\", this property defines the new value of the key-value pair\n    * `event.object` The object on which the event occurred (The object on which `.observe(..)` was called)\n* .observeDeep(function observer(event){..})\n  * Same as .observe, but catches events from all children (if they support .observeDeep)\n  * `event.path` specifies the path of the change event\n* .observePath(path, observer) *deprecated*\n  * `path` is an array of property keys\n  * `observer` is when the value under the path is found\n  * `observer` is called when the property under `path` is set, deleted, or updated\n  * returns a function which, if called, removes the observer from the path\n* .unobserve(f)\n  * Delete an observer\n\n# A note on intention preservation\nWhen users create/update/delete the same property concurrently, only one change will prevail. Changes on different properties do not conflict with each other.\n\n# A note on time complexities\n* .get(key)\n  * O(1)\n* .set(key, value)\n  * O(1)\n* .delete(key)\n  * O(1)\n* Apply a delete operation from another user\n  * O(1)\n* Apply an update operation from another user (set/update a property)\n  * Yjs does not transform against operations that do not conflict with each other.\n  * An operation conflicts with another operation if it changes the same property.\n  * Overall worst case complexety: O(|conflicts|^)\n\n## Changelog\n\n### 10.0.0\n* inserting \u0026 retrieving types are synchronous operations\n  * I.e. `y.share.map.get('some type') // =\u003e returns a type instead of a promise\n* relies on Yjs@^12.0.0\n\n## License\nYjs is licensed under the [MIT License](./LICENSE.txt).\n\n\u003ckevin.jahns@rwth-aachen.de\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-js%2Fy-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fy-js%2Fy-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-js%2Fy-map/lists"}