{"_id":"@artfable/backbone-extension","_rev":"4-ce36c27179a17d664e4159281599742e","time":{"3.0.0":"2018-10-14T15:56:39.597Z","created":"2018-10-14T15:57:02.904Z","3.0.1":"2018-10-14T15:57:03.215Z","modified":"2022-04-04T15:37:12.670Z"},"name":"@artfable/backbone-extension","dist-tags":{"latest":"3.0.1"},"versions":{"3.0.1":{"name":"@artfable/backbone-extension","version":"3.0.1","description":"Extensions for the backbone framework to simplify work with UI","main":"backbone-extension.js","repository":{"type":"git","url":"git+https://github.com/artfable/backbone-improvement.git"},"dependencies":{"backbone":"1.3.3"},"devDependencies":{"@artfable/js-logger":"1.0.1"},"author":{"name":"artfable"},"license":"MIT","publishConfig":{"access":"public"},"gitHead":"20cee014daa7242b9b40af60be69a6878e1a52fd","bugs":{"url":"https://github.com/artfable/backbone-improvement/issues"},"homepage":"https://github.com/artfable/backbone-improvement#readme","_id":"@artfable/backbone-extension@3.0.1","scripts":{},"_shasum":"4c560961bcea3370cf686ff55cafd13f5ec35525","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.10.1","_npmUser":{"name":"artfable","email":"art-fable@mail.ru"},"dist":{"shasum":"4c560961bcea3370cf686ff55cafd13f5ec35525","tarball":"https://registry.npmjs.org/@artfable/backbone-extension/-/backbone-extension-3.0.1.tgz","integrity":"sha512-QJNbCS34P/Hec813Yp5+qe7z9C1cYDcZmWtVL6pVq3blj4YpbPpXTbqF8Etgeu/HZrSa2oG0BsRlCwcsQMZ88g==","fileCount":28,"unpackedSize":106786,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbw2dPCRA9TVsSAnZWagAAzbcP/i+vVVgAOcK3wZBckN+z\nJxgepCtk1I9A7J/S7WdDV6/33bID2QqHTn9ytNWGypvdWgcl/5V5g2M/i9Jg\nu+KC6C43ViysGrc9ZEymic/MP+kAzm8jvqfvDYvfZOokLbozY8EMmO07zUGP\nRD0X4nuuuzV4z/MfWVzOk8iHoEUKIR+YPKptSIHPqnEQEKP2GVUXAmvaPg+0\nCMyvbOaacTeB97iF795WXA6R2q9dZMsNZ+I3dmSgdUhSCd2TFrqFMBFv9KnA\nze6Wa7anZlDryY0BaWVoSRD2lj2AfzTDXd0NTMqOjmu8i3kWENpGoNClqMnx\nydSFXmnwGACHihnBdjrJFL/zx7rMMSeXgEb2oaVnk6UL42XulcibTsJNz8DW\n5Qf3XDFux6pGWwiHZ4wWuvroTmQs+zdtqYajuSdZniyL6/V9CtwXvWWajtcg\neqS0QSoDTSCAPukhZI/h9lU8ySbfvI7dFHdjDOF3JXHI8+sehTdhSxgz2Sgy\nwRNXGrbbiDtGQK1slaWPMiwhCZ7CnATUdxBs6MFkQnqe2IsM0296OKEOxhk9\ncZBQmncPmT85I5vSz8QuSrCi59keR7YTTmgj42DTjFUvYd7hlBVv0Q7zLojB\n62W+lqwD/Vux6zZh6zGly4W86NKfsY+6On6G1rcRiesKtpkGT+WFX6FFw1hg\n/NQ9\r\n=ZlYL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDyhnsjENs79iTzRcmAdYKPGyNvWi3/7WjFE0M+YhPmqAIgOjqpAQ3KQ4vjHhhHJAR5CY1vIo0PXBORLRRnzz9ScU8="}]},"maintainers":[{"name":"artfable","email":"art-fable@mail.ru"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/backbone-extension_3.0.1_1539532623073_0.42310696368942113"},"_hasShrinkwrap":false}},"maintainers":[{"name":"artfable","email":"art-fable@mail.ru"}],"description":"Extensions for the backbone framework to simplify work with UI","homepage":"https://github.com/artfable/backbone-improvement#readme","repository":{"type":"git","url":"git+https://github.com/artfable/backbone-improvement.git"},"author":{"name":"artfable"},"bugs":{"url":"https://github.com/artfable/backbone-improvement/issues"},"license":"MIT","readme":"# backbone-improvement\nSome utils to make easy work with [Backbone](http://backbonejs.org/) <br/>\n(Version 3.0.0)\n\n### Dependencies\njQuery (http://jquery.com/) <br/>\nUnderscore (http://underscorejs.org/) <br/>\nBackbone (http://backbonejs.org/)\n\n## Backbone extension\nSome additions to backbone for simplifies application.\nIf you use [Logger](https://github.com/artfable/js-logger) - logger name will be 'backboneExtension'.  \nLogger should be set to `window.Logger`\n\n### Install\n\nAvailable [through npm](https://www.npmjs.com/package/@artfable/js-logger)\n\n    npm i @artfable/backbone-extension\n\n### Settings\n\n#### \\_commonTitleConfig `Object` *default: {on: false, front: false, separator: '|', text: ''}*\nConfiguration for common part of the title, for all views. Set to `Backbone._commonTitleConfig`\n\n\n### View\nAdditional methods to the `Backbone.View` and some changes on it. `View` is a some part of a page. \n\n#### templateUrl `string`\nAddress of template with what view will be associated.\n\n#### template `template()`\n[Underscore](http://underscorejs.org/) template from file that was define in `templateUrl`.\n\n#### events `Array`\n**Deprecated**, use origin [Backbone events](http://backbonejs.org/#View-events). <br/>\nStructure of events:\n\n+ *selector* - string or function. Selector of a DOM element. If function - must return string, `this` will be the View.\n+ *event* - string. JQuery event\n+ *call* - string. Name of callback function, this function must be declared in the view. The entrees param is `event`.\n+ *params* - Object, optional. Parameters that will be given to callback function as `event.data`\n\n#### eventsApply `eventsApply()`\n**Deprecated**, use origin [Backbone events](http://backbonejs.org/#View-events). <br/>\nApply events to DOM elements. Should be called in `resolve`, after view will be rendered.\n\n#### title `string`\nSet it if you need to change title for page associated with this view. No action if it's not set.\nTo reset for only common part - set ''.\n\n#### setTitle `setTitle(title)`\nSet page title and add common part to it, if it's turned on (see `_commonTitleConfig`). \n\n#### afterInitialize `afterInitialize()`\nShould be used instead of `initialize`.\n\n#### resolve `resolve([...arguments])`\nShould be used instead of `render`. `Arguments` - some parameters that was sent from `router`.\n\n\n### Page\nInclude all `View`s from page, and a `Layout` to locate them. `Backbone.Page`.\n\n#### title `string`\nSet it if you need to change title for page associated with this view. If it's not set, apply only common part to title (see `\\_commonTitleConfig`).\n\n#### views `Array`\nList of metadata of `View`s that `Page` content. Each metadata consist of:\n\n+ *region* - `string`. Selector of block where `View` must be rendered.\n+ *view* - `Backbone.View`\n\n#### layout `Backbone.Layout`\nLayout for `Page`.\n\n#### layoutOptions `Backbone.Model` or `Object`\nSome options to render layout, can be used in layout template.\n\n#### setTitle `setTitle(title)`\nSet page title and add common part to it, if it's turned on (see `_commonTitleConfig`). \n\n#### afterInitialize `afterInitialize()`\nSome actions, that will be done, after the page will be initialized.\n\n\n### Layout\nLayout for `View`s on `Page`.\n\n#### templateUrl `string`\nAddress of template with what layout will be associated.\n\n#### template `template()`\n[Underscore](http://underscorejs.org/) template from file that was define in `templateUrl`.\n\n#### el and $el\nSee in [Backbone](http://backbonejs.org/). `Backbone.View.el` and `Backbone.View.$el`.\n\n#### initialize `initialize()`\nSome actions, that will be done, after the layout will be initialized.\n\n#### afterRender `afterRender()`\nSome actions, that will be done, after the layout will be rendered.\n\n#### setRegion `setRegion(region, view)`\nSet `View` to chosen region.\n\n+ *region* - `string`. Selector of block where `View` must be rendered.\n+ *view* - `Backbone.View`\n\n\n### RouterBuilder\nThe builder for construct `Backbone.Router`. Log navigation to debug level. Save information about navigation. `Backbone.routerBuilder`\n\n#### addStateHolder `addStateHolder(stateHolder)`\n*stateHolder* - `Backbone.Model`. Model that will be kept information about navigation. In property `page` will be name of function that was called.\n\n#### addRoute `addRoute(path, actionName, action)`\nAdd route.\n\n+ *path* - string. Route.\n+ *actionName* - name of the route.\n+ *action* - function or `View` or `Page` that will be called on the *path*.\n\n#### addBeginRoute `addBeginRoute(actionName, view)`\nAdd route that will be at the start page. Same as `addRoute`, but `path` is already set with all possible paths.\n\n+ *actionName* - name of the route.\n+ *action* - function or `View` or `Page` that must be rendered on start page.\n\n#### addAdditionalOptions `addAdditionalOptions(options)`\nSome extra options for add to `Backbone.Router`.\n\n#### build `build()`\nShould be called at the end. Create and return `Backbone.Router`.\n\n### Router\nResult of `RouterBuilder`.\n\n#### execute `execute(callback, args, name)` *set by default*\nNow, by default set `name` (name of the route) into `stateHolder`, into property `page`. \nAlso log `name` in console with `debug` level.\n\n#### routeByView `routeByView(route, name, view)`\nAdd route.\n\n+ *route* - string. Route.\n+ *name* - name of the route.\n+ *view* - `View` or `Page` that will be called on the *route*.\n\n#### routeStartView `routeStartView(name, view)`\nAdd route that will be at the start page. Same as `routeByView`, but `route` is already set with all possible paths.\n\n+ *name* - name of the route.\n+ *view* - `View` or `Page` that must be rendered on start page.\n\n**Note!** If you set it after call `Backbone.history.start`, then it won't open page first time. Or you need to restart.","readmeFilename":"README.md"}