{"id":17772729,"url":"https://github.com/jamesplease/backbone.event-spec","last_synced_at":"2025-06-29T15:33:34.069Z","repository":{"id":16685550,"uuid":"19441809","full_name":"jamesplease/backbone.event-spec","owner":"jamesplease","description":"An unofficial specification for Backbone Event names.","archived":false,"fork":false,"pushed_at":"2014-05-28T03:06:07.000Z","size":165,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-09T04:05:11.803Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"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/jamesplease.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-05-05T02:41:39.000Z","updated_at":"2023-03-10T08:28:26.000Z","dependencies_parsed_at":"2022-09-24T09:13:32.237Z","dependency_job_id":null,"html_url":"https://github.com/jamesplease/backbone.event-spec","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jamesplease/backbone.event-spec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesplease%2Fbackbone.event-spec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesplease%2Fbackbone.event-spec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesplease%2Fbackbone.event-spec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesplease%2Fbackbone.event-spec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesplease","download_url":"https://codeload.github.com/jamesplease/backbone.event-spec/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesplease%2Fbackbone.event-spec/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262618616,"owners_count":23338051,"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-26T21:40:34.079Z","updated_at":"2025-06-29T15:33:34.051Z","avatar_url":"https://github.com/jamesplease.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"backbone.event-spec\n===================\n\nAn unofficial specification for Backbone Event names.\n\n### About\n\nBackbone has a simple event system that is used to transfer information between objects in your Application. Perhaps the most\ncommon example of this is the `change` event fired when a Model's property changes.\n\nThis is an unofficial specification that combines a precedent set by Backbone with a few additional rules to create\na consistent, extensible event naming system. This allows you to use custom Backbone Events in a predictable manner throughout\nyour application.\n\n### Structure\n\nEvents in Backbone classes should follow the following format:\n\n`adverb:action:subject`\n\n##### The Separator\n\nThe separator is used to separate the three pieces of the event name, described above. It's a colon, `:`. The colon should only\nbe used to separate the different sections of the event name. Within each section camel case should be used for multiple words.\n\n```js\n// Using the separator incorrectly\n'showMyView';\n'show-view';\n'show:my:view';\n\n// Using it correctly\n'show:myView';\n```\n\n##### The adverb\n\nThe first part of the event name is the adverb. The most common adverb to use is `before`. The adverb is optional. In Backbone\nthere are no standard events triggered with an adverb.\n\nThe following example shows an event that might be triggered before a close event on a custom class.\n\n`before:close`\n\nDo note that you should never use the adverb `after`. Backbone Events without an adverb are assumed to always be fired after\nthe event occurs. For instance, `change` is only fired on the Model *after* its properties have been changed.\n\n##### The action\n\nThe action is always present tense. The action should be a simple verb that describes the event\nthat just happened. The action is the only required part of the event name.\n\n```js\n// Bad Backbone event name\n'rendered';\n\n// Good Backbone event name\n'render';\n```\n\n##### The subject\n\nThe last part of the event name is the subject. Like the adverb, the subject is optional. An event may have at most\na single subject.\n\nThe subject is ideally a simple, one-word noun. In the case of a more complex noun you should use colons\nto separate out the pieces.\n\nHere is an example event name that might be fired when a child view is shown by the parent:\n\n```js\n'show:child';\n```\n\nWhen the subject of the verb is the object itself you can omit it. For instance, the event is just `change` in Backbone, not\n`change:model`. Only when it's referencing a particular property of the model does it use the subject.\n\nWe can use this pattern to determine possible event names for rendering a view.\n\n```js\n// When a view renders\n'render';\n\n// When a child view of a parent view renders\n'render:child';\n```\n\n##### Compound actions and subjects\n\nIf any part of the event consists of more than one word, then camel case should be used to separate them. Note that no standard Backbone Event has\na compound action or subject, and in general they should be avoided when possible.\n\nAn example of an event with a compound subject would be:\n\n`show:redButton`\n\nIn this case, the subject has an adjective describing it, and they are written in camel case.\n\n### Consistency\n\nThis specification is unofficial, so you shouldn't think of it as the *right way* to name your events.\n[Even I'm not sure](https://github.com/jmeas/backbone.event-spec/issues/1) if I completely like everything here. This is\njust an opinionated way to remain consistent.\n\nAnd that philosophy of consistency is more important than any rule in this document. However you decide to name your events is\nabsolutely fine, so long as you follow some set of rules. This becomes increasingly important as your applications grow. It can save time\nif you can just 'know' what the event name is based on your own guidelines, rather than always having to look it up.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesplease%2Fbackbone.event-spec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesplease%2Fbackbone.event-spec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesplease%2Fbackbone.event-spec/lists"}