{"id":16742243,"url":"https://github.com/oscarmorrison/omodel","last_synced_at":"2025-03-16T00:20:47.342Z","repository":{"id":71204248,"uuid":"75548497","full_name":"oscarmorrison/oModel","owner":"oscarmorrison","description":"Simplest JS Model with listeners","archived":false,"fork":false,"pushed_at":"2016-12-06T02:44:46.000Z","size":34,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T13:16:30.920Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://oscarmorrison.com/oModel","language":"JavaScript","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/oscarmorrison.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":"2016-12-04T16:11:25.000Z","updated_at":"2016-12-05T02:40:17.000Z","dependencies_parsed_at":"2023-06-27T01:43:38.628Z","dependency_job_id":null,"html_url":"https://github.com/oscarmorrison/oModel","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/oscarmorrison%2FoModel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscarmorrison%2FoModel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscarmorrison%2FoModel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscarmorrison%2FoModel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oscarmorrison","download_url":"https://codeload.github.com/oscarmorrison/oModel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243807454,"owners_count":20350996,"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-10-13T01:23:07.798Z","updated_at":"2025-03-16T00:20:47.336Z","avatar_url":"https://github.com/oscarmorrison.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oModel\n\noModel is a work in progress, with no public release yet.\n\n## Goal  \nBuild a super simple js model that allows for onChange call backs.  \n\n### Insperation\n- [Backbone.Model](http://backbonejs.org) (Jeremy Ashkenas you're brilliant!)\n- [Mettle](https://github.com/jmoyers/mettle)\n\n## Installation\n*TBD bower and npm dependency*  \n- compatible as client or node dependancy\n\n\n## API Docs\n\n**Create a new model** (without any attributes)\n```javascript\nvar person = new Model();\n\n```\n**or with attributes / properties** \n```javascript\nvar person = new Model({\n    name: 'oscar'\n});\n```\n\n**Set / Update attributes**\n```javascript\nperson.set('age', 25);\n```\n**...or multiple at once**  \n```javascript\nperson.update({\n    name: 'george',\n    age: 20\n});\n```\n*update is an alias for set*  \n\n**Listen to models**  \n```javascript\nvar callback = function(attributes) {\n    console.log(attributes);\n}\nperson.onChange(callback);\n```\n\n**OnChange**\n```javascript\nperson.update('name', 'edward');\n\n// callback log\n// {name: 'edward', age: 20}\n\n```\n\n**Stop listening to models for callback**\n```javascript\nperson.off(callback)\n```\n\n**Stop listening to models all**\n```javascript\nperson.off()\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foscarmorrison%2Fomodel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foscarmorrison%2Fomodel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foscarmorrison%2Fomodel/lists"}