{"id":15659914,"url":"https://github.com/typicode/backbone-pegasus","last_synced_at":"2025-05-05T19:55:56.775Z","repository":{"id":18445865,"uuid":"21637526","full_name":"typicode/backbone-pegasus","owner":"typicode","description":"Load models and collections data while loading Backbone","archived":false,"fork":false,"pushed_at":"2014-12-26T14:29:08.000Z","size":243,"stargazers_count":20,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T08:16:28.995Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/typicode.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":"2014-07-09T03:16:47.000Z","updated_at":"2024-06-14T06:09:52.000Z","dependencies_parsed_at":"2022-09-10T23:56:26.896Z","dependency_job_id":null,"html_url":"https://github.com/typicode/backbone-pegasus","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typicode%2Fbackbone-pegasus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typicode%2Fbackbone-pegasus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typicode%2Fbackbone-pegasus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typicode%2Fbackbone-pegasus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typicode","download_url":"https://codeload.github.com/typicode/backbone-pegasus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252568535,"owners_count":21769468,"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-03T13:19:34.437Z","updated_at":"2025-05-05T19:55:56.754Z","avatar_url":"https://github.com/typicode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# backbone-pegasus ![Bower](https://img.shields.io/bower/v/backbone-pegasus.svg?style=flat)\n\n\u003e Improve your Backbone app loading time with [Pegasus](https://github.com/typicode/pegasus).\n\nUsing backbone-pegasus, you can start loading data while still loading Backbone and other scripts.\n\n## Show me\n\n![](http://i.imgur.com/gT3DR18.png)\n\n_Obviously, in production you should concatenate your app scripts._\n\nHowever, what's important in this screenshot is that  data (yellow bar) is being loaded:\n\n* as soon as `backbone-pegasus.js` has finished loading\n* in parallel with the other scripts\n\nYou can find a working app in the example directory.\n\nSee also http://typicode.github.io/pegasus/ for other live examples.\n\n## Usage\n\n```html\n\u003cscript src=\"backbone-pegasus.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n\n  // Preload URL(s)\n  BackbonePegasus.get('http://api.example.com/users');\n  BackbonePegasus.get('http://api.example.com/posts');\n  \n\u003c/script\u003e\n\n\u003cscript src=\"jquery.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"underscore.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"backbone.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"app.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n\n  // Set up backbone-pegasus\n  BackbonePegasus.setup();\n  \n  // Start your app\n  app.start();\n\n\u003c/script\u003e\n```\n\n__There's nothing else to change in your app.__\n\n`BackbonePegasus.setup()` modifies `Backbone.sync()` so that it checks for URLs loaded by backbone-pegasus. If there's no match, it falls back to `Backbone.sync()` original method.\n\n## Routing\n\nTo keep things light and fast, backbone-pegasus doesn't come with a router.\n\nBut depending on your needs, you can write your own:\n\n```javascript\nvar base = 'http://api.example.com';\n\n// Will preload URLs based on hash\nswitch(window.location.hash) {\n  case '#posts':\n    BackbonePegasus.get(base + '/posts');\n    break;\n  case '#users':\n    BackbonePegasus.get(base + '/users');\n    break;\n  default:\n    BackbonePegasus.get(base + '/posts');\n}\n```\n\n_Another [custom router example](https://github.com/typicode/backbone-pegasus/blob/master/example/index.html#L37) can be found in the example directory._\n\nYou can also use a third-party library like [route-recognizer](https://github.com/tildeio/route-recognizer).\n\n## Support\n\nAll modern browsers and IE8+\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypicode%2Fbackbone-pegasus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypicode%2Fbackbone-pegasus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypicode%2Fbackbone-pegasus/lists"}