{"id":21326231,"url":"https://github.com/masylum/backbone.partial-fetch","last_synced_at":"2025-07-12T06:33:03.561Z","repository":{"id":7969539,"uuid":"9369841","full_name":"masylum/backbone.partial-fetch","owner":"masylum","description":"Allows you to do smart partial fetching","archived":false,"fork":false,"pushed_at":"2013-11-15T10:43:29.000Z","size":157,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-06-11T18:46:40.149Z","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/masylum.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":"2013-04-11T12:35:28.000Z","updated_at":"2017-06-12T12:59:55.000Z","dependencies_parsed_at":"2022-08-03T15:09:51.846Z","dependency_job_id":null,"html_url":"https://github.com/masylum/backbone.partial-fetch","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/masylum%2Fbackbone.partial-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masylum%2Fbackbone.partial-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masylum%2Fbackbone.partial-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masylum%2Fbackbone.partial-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masylum","download_url":"https://codeload.github.com/masylum/backbone.partial-fetch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225802658,"owners_count":17526452,"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-21T21:08:52.300Z","updated_at":"2024-11-21T21:08:52.917Z","avatar_url":"https://github.com/masylum.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backbone.partialFetch\n\nFetch partial data for a collection and does smart updates by:\n\n  - Adding missing models\n  - Updating existent models\n  - Removing models not available anymore\n\n## Why not use backbone `fetch`?\n\nBackbone `fetch` works beautifully on fetching the whole resource representation but\nyou can't use it to do **smart updates** when fetching a partial part of that resource.\n\n## How does it work\n\nIt works exactly like `fetch` but if you add a `filter` option:\n\n  - It will be passed to the `url` so you can compose a url to fetch the subset\n  - It will be used to determine wich elements have to be removed\n\nAdding and updating existing models is done internally by backbone's `set`\n\n```js\nCollections.tasks.reset([\n  {id: 1, name: 'Foo', project_id: 1}\n, {id: 2, name: 'Bar', project_id: 2}\n, {id: 3, name: 'Pole', project_id: 2}\n]);\n\nCollections.tasks.partialFetch({\n  filter: {project_id: 1}\n, success: function (collection, response) {\n    // response is -\u003e [\n      {id: 2, name: 'Bar', project_id: 1}\n    , {id: 4, name: 'Jambo', project_id: 1}\n    ]\n\n    // collection is -\u003e [\n      {id: 2, name: 'Bar', project_id: 1}\n    , {id: 3, name: 'Pole', project_id: 2}\n    , {id: 4, name: 'Jambo', project_id: 1}\n    ]\n  }\n});\n```\n\n## Test\n\n```\nmake test\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2013 Pau Ramon \u003cmasylum@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasylum%2Fbackbone.partial-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasylum%2Fbackbone.partial-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasylum%2Fbackbone.partial-fetch/lists"}