{"_id":"ampersand-registry","_rev":"26-5510b13c722be3076dc791e7f8b5d98f","name":"ampersand-registry","description":"Global model registry for tracking instantiated models accross collections.","dist-tags":{"latest":"0.2.4"},"versions":{"0.1.0":{"name":"ampersand-registry","description":"Global model registry for tracking instantiated models accross collections.","version":"0.1.0","author":{"name":"Henrik Joreteg","email":"henrikandyet.net"},"bugs":{"url":"https://github.com/ampersandjs/ampersand-registry/issues"},"devDependencies":{"precommit-hook":"0.x.x","tape":"2.x.x"},"homepage":"https://github.com/ampersandjs/ampersand-registry","keywords":["models","collection"],"license":"MIT","main":"ampersand-registry.js","repository":{"type":"git","url":"git://github.com/ampersandjs/ampersand-registry"},"scripts":{"test":"node test/main.js"},"_id":"ampersand-registry@0.1.0","dist":{"shasum":"768f9ba6c9a4532c37539a481ce209b223d7112d","tarball":"https://registry.npmjs.org/ampersand-registry/-/ampersand-registry-0.1.0.tgz","integrity":"sha512-RJRxr96Hcn8K2lLYlZoqvrViNw/xsMM4hDfqL/uuWFnBxQ21h/l1fiRNNghHKMj/8BBU+bJ6tdfhqrqfT9kT8Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD9HYrKNkV1wEP3TUac8tpvytoTp+2m6Q3coxZTQa1ugwIgQ5P1wsRMLjiAXFjL865SlpBwSSFmK5ZjU7Ijy798Mn4="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"0.1.1":{"name":"ampersand-registry","description":"Global model registry for tracking instantiated models accross collections.","version":"0.1.1","author":{"name":"Henrik Joreteg","email":"henrikandyet.net"},"bugs":{"url":"https://github.com/ampersandjs/ampersand-registry/issues"},"devDependencies":{"precommit-hook":"0.x.x","tape":"2.x.x","browserify":"*"},"homepage":"https://github.com/ampersandjs/ampersand-registry","keywords":["models","collection"],"license":"MIT","main":"ampersand-registry.js","repository":{"type":"git","url":"git://github.com/ampersandjs/ampersand-registry"},"scripts":{"build":"browserify -e ampersand-registry.js -o ampersand-registry.bundle.js -s AmpersandRegistry","test":"node test/main.js"},"_id":"ampersand-registry@0.1.1","dist":{"shasum":"334457d0bb6723ff4faf5f71cf93d11b9f8d94ac","tarball":"https://registry.npmjs.org/ampersand-registry/-/ampersand-registry-0.1.1.tgz","integrity":"sha512-vOg4QKn5dbvFFm41Wr0HdDzE/DdidHsvH3sIR4rsDzu4KfRWV35X2KZ6Z7nJC/qmE5XLBBSoKgN/zdzMo5wZrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF8uuKSXYzgOzwnk+riUdlpyUOMgGTXdrGIU2VjG7ntRAiAz91u2Padmh2DMmJn0n61wWQBnsqGbTEepmqzq7BGKLg=="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"0.1.2":{"name":"ampersand-registry","description":"Global model registry for tracking instantiated models accross collections.","version":"0.1.2","author":{"name":"Henrik Joreteg","email":"henrikandyet.net"},"bugs":{"url":"https://github.com/ampersandjs/ampersand-registry/issues"},"devDependencies":{"precommit-hook":"0.x.x","tape":"2.x.x","browserify":"*"},"homepage":"https://github.com/ampersandjs/ampersand-registry","keywords":["models","collection"],"license":"MIT","main":"ampersand-registry.js","repository":{"type":"git","url":"git://github.com/ampersandjs/ampersand-registry"},"scripts":{"build":"browserify -e ampersand-registry.js -o ampersand-registry.bundle.js -s AmpersandRegistry","test":"node test/main.js"},"_id":"ampersand-registry@0.1.2","dist":{"shasum":"34c220d91e6b6a85f8b4fe53f12ce815b11f2422","tarball":"https://registry.npmjs.org/ampersand-registry/-/ampersand-registry-0.1.2.tgz","integrity":"sha512-PoYV0YwjY+wpYWsUXO0K9paWBbAzDEc3/KhKJO8K7PG7KGvWmi1pDu6CEzz+SQ+NehoU8e4shXA5W0juju7FLA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCB1YBCD7/FU1Uyl+2UqRM3loBHyC6IfLhkQgXjJhyBtgIhAIByTaxGiQ/3RlN13DRqcywlhZClC80TB5QB02IPMAEr"}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"0.2.0":{"name":"ampersand-registry","description":"Global model registry for tracking instantiated models accross collections.","version":"0.2.0","author":{"name":"Henrik Joreteg","email":"henrikandyet.net"},"bugs":{"url":"https://github.com/ampersandjs/ampersand-registry/issues"},"devDependencies":{"ampersand-state":"0.x.x","precommit-hook":"0.x.x","tape":"2.x.x"},"homepage":"https://github.com/ampersandjs/ampersand-registry","keywords":["models","collection"],"license":"MIT","main":"ampersand-registry.js","repository":{"type":"git","url":"git://github.com/ampersandjs/ampersand-registry"},"scripts":{"test":"node test/main.js"},"testling":{"files":"test/*.js","browsers":["ie/9..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"_id":"ampersand-registry@0.2.0","dist":{"shasum":"33288ba469300ca1779e3b4cb2a99fcaef7dbfd3","tarball":"https://registry.npmjs.org/ampersand-registry/-/ampersand-registry-0.2.0.tgz","integrity":"sha512-kExaLITduic4y//ik7j8fZ6dLdQJKKEKqOsRPPiD7OyriASlsKdnJgwediBpP5bxiwTPwmN/5jG9evfeWfZFMw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCTpNV4nB9IlwOfwYPnGGN+aXczL8i1Eltm4E9JrYhGcgIhANf9Xb+w23QXWUaD5ZJ8Oz5W/8PlX5sIfPGnLAwu9IOx"}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"0.2.1":{"name":"ampersand-registry","description":"Global model registry for tracking instantiated models accross collections.","version":"0.2.1","author":{"name":"Henrik Joreteg","email":"henrikandyet.net"},"bugs":{"url":"https://github.com/ampersandjs/ampersand-registry/issues"},"devDependencies":{"ampersand-state":"0.x.x","precommit-hook":"0.x.x","tape":"2.x.x"},"homepage":"https://github.com/ampersandjs/ampersand-registry","keywords":["models","collection"],"license":"MIT","main":"ampersand-registry.js","repository":{"type":"git","url":"git://github.com/ampersandjs/ampersand-registry"},"scripts":{"test":"node test/main.js"},"testling":{"files":"test/*.js","browsers":["ie/9..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"_id":"ampersand-registry@0.2.1","dist":{"shasum":"a23e4570872e770d1983629d201c7cad6b54e33b","tarball":"https://registry.npmjs.org/ampersand-registry/-/ampersand-registry-0.2.1.tgz","integrity":"sha512-xm714/4SrQK/YRrUrXt3wzPwO9jZjq1RA0oMy1oYDxXHIBgpfKN/qei2DazCysPXg96gT5vr0fAq4tcAA3ra3Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCvhh4xQ0O0EX9GKngYngf8qW8byAsuBo0exObuz/HbWAIhAN1NxgI/fXOJsdYKx7gu7KYAkEAZwj6XVHdOohs34My+"}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"0.2.2":{"name":"ampersand-registry","description":"Global model registry for tracking instantiated models accross collections.","version":"0.2.2","author":{"name":"Henrik Joreteg","email":"henrikandyet.net"},"bugs":{"url":"https://github.com/ampersandjs/ampersand-registry/issues"},"devDependencies":{"ampersand-state":"0.x.x","browserify":"^5.11.0","phantomjs":"^1.9.7-15","precommit-hook":"0.x.x","run-browser":"^1.3.1","tap-spec":"^0.2.1","tape":"2.x.x","tape-run":"^0.3.0"},"homepage":"https://github.com/ampersandjs/ampersand-registry","keywords":["models","collection"],"license":"MIT","main":"ampersand-registry.js","repository":{"type":"git","url":"git://github.com/ampersandjs/ampersand-registry"},"scripts":{"start":"run-browser test/main.js","test":"browserify test/main.js | tape-run | tap-spec"},"testling":{"files":"test/*.js","browsers":["ie/9..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"5ef795e2e80ff87747fc3477e15bb674127f9575","_id":"ampersand-registry@0.2.2","_shasum":"fda74648aa8a148312471807c4d006e1e79fa5b5","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"lukekarrys","email":"luke@lukekarrys.com"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"},{"name":"lukekarrys","email":"luke@lukekarrys.com"}],"dist":{"shasum":"fda74648aa8a148312471807c4d006e1e79fa5b5","tarball":"https://registry.npmjs.org/ampersand-registry/-/ampersand-registry-0.2.2.tgz","integrity":"sha512-t6rfLEVdnL81PazR0LQMYuI7F6edisibFXFHr38HPRe3Z7ne8rIxMGwEuJaQY9+C0SNmDawKM4dUVrrOVaZt5g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDP7GSd/9c19BlslzIqKEDTpJALdTDzGwy0gWUNsxKViQIgYW0NHpIftWui0uvAlrllK1fw37ODD0mptxooo44jct0="}]},"directories":{}},"0.2.4":{"name":"ampersand-registry","description":"Global model registry for tracking instantiated models accross collections.","version":"0.2.4","author":{"name":"Henrik Joreteg","email":"henrikandyet.net"},"bugs":{"url":"https://github.com/ampersandjs/ampersand-registry/issues"},"devDependencies":{"ampersand-state":"0.x.x","browserify":"^5.11.0","phantomjs":"^1.9.7-15","precommit-hook":"0.x.x","run-browser":"^1.3.1","tap-spec":"^0.2.1","tape":"2.x.x","tape-run":"^0.3.0"},"homepage":"https://github.com/ampersandjs/ampersand-registry","keywords":["models","collection"],"license":"MIT","main":"ampersand-registry.js","repository":{"type":"git","url":"git://github.com/ampersandjs/ampersand-registry"},"scripts":{"start":"run-browser test/main.js","test":"browserify test/main.js | tape-run | tap-spec"},"testling":{"files":"test/*.js","browsers":["ie/9..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"browserify":{"transform":["ampersand-version"]},"dependencies":{"ampersand-version":"^1.0.0"},"gitHead":"b2f636dea46236d0ecde0fa6a9b479ee45e22729","_id":"ampersand-registry@0.2.4","_shasum":"6066f1d2558e4feeb0fd30bcf36e602913d0e65f","_from":".","_npmVersion":"2.7.5","_nodeVersion":"0.12.1","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"},{"name":"lukekarrys","email":"luke@lukekarrys.com"}],"dist":{"shasum":"6066f1d2558e4feeb0fd30bcf36e602913d0e65f","tarball":"https://registry.npmjs.org/ampersand-registry/-/ampersand-registry-0.2.4.tgz","integrity":"sha512-ajnVOFL01m6CEv+GEXMFfSmwbkgS32KAQK85Ufx1LUAEKucj3dY6VaLjflBoCDawtsIDiwArAv7XjILDNGHA1w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG7iAikdSOBIkuATetC3FUUT9SirM/AAUzUtHrrocgV4AiAlAfm0HhI6t08UqAdgsc1a7DP97tAn4fniNKB3yqwizQ=="}]},"directories":{}}},"readme":"# ampersand-registry\n\nGlobal model registry for tracking instantiated models across collections.\n\nThis isn't necessary for most apps, but sometimes it's useful to create a global registry of all or a subset of instantiated models in your application. This can be useful when realtime applications where you're getting incoming events with IDs and model types and need some global way to look up models in your application.\n\nThe code is quite short and simple it's only ~50 lines. It may be easiest to just read the code for documetation. But some examples/explanations are included below.\n\n<!-- starthide -->\nPart of the [Ampersand.js toolkit](http://ampersandjs.com) for building clientside applications.\n<!-- endhide -->\n\n## install\n\n```\nnpm install ampersand-registry\n```\n\n## browser support\n\n[![testling badge](https://ci.testling.com/AmpersandJS/ampersand-registry.png)](https://ci.testling.com/AmpersandJS/ampersand-registry)\n\n## example\n\n```javascript\nvar Registry = require('ampersand-registry');\nvar Model = require('ampersand-model');\n\n// a singleton model registry\nwindow.registry = new Registry();\n\n// then whenever we're defining models for our application\n// if we're using ampersand-model (or its lower level cousin\n// ampersand-state) we can store that model in the registry \n// in the initialize method\n\nvar MyModel = Model.extend({\n    modelType: 'user',\n    props: {\n        name: 'string'\n    },\n    initialize : function(){\n        window.registry.store(this);\n        this.on('destroy', function(){\n            window.registry.remove(this.getType(), this.getId());\n        }, this);\n        \n    }\n});\n```\n\nAfter doing this all instantiated models will be put into the registry based on their `modelType` property and be removed when destroyed.\n\nThen the registry can be used to look up models as follows:\n\n```javascript\n// explicitly storing a model\n// this will use the models `type`, `getId`, and `namespace` \n// properties to store this accordingly.\nregistry.store(model);\n\n// get a model\nregistry.lookup('{{model type}}', '{{ model id }}', '{{ optional namespace }}');\n\n// remove a stored model from the store by type, id and optionally namespace\nregistry.remove('{{model type}}', '{{ model id }}', '{{ optional namespace }}');\n\n// de-reference all models\nregistry.clear();\n```\n\n<!-- starthide -->\n\n## credits\n\nIf you like this follow [@HenrikJoreteg](http://twitter.com/henrikjoreteg) on twitter.\n\n## license\n\nMIT\n\n<!-- endhide -->\n","maintainers":[{"email":"daniel.hritzkiv@gmail.com","name":"dhritzkiv"},{"email":"giladp007@gmail.com","name":"pgilad"},{"email":"fyockm@gmail.com","name":"fyockm"},{"email":"henrik@joreteg.com","name":"henrikjoreteg"}],"time":{"modified":"2022-06-13T02:46:13.555Z","created":"2014-03-17T05:19:13.369Z","0.1.0":"2014-03-17T05:19:13.369Z","0.1.1":"2014-03-17T18:50:30.346Z","0.1.2":"2014-03-20T04:35:27.845Z","0.2.0":"2014-03-31T04:37:08.205Z","0.2.1":"2014-04-09T04:25:14.894Z","0.2.2":"2014-09-04T21:26:51.617Z","0.2.4":"2015-05-20T17:54:11.594Z"},"homepage":"https://github.com/ampersandjs/ampersand-registry","keywords":["models","collection"],"repository":{"type":"git","url":"git://github.com/ampersandjs/ampersand-registry"},"author":{"name":"Henrik Joreteg","email":"henrikandyet.net"},"bugs":{"url":"https://github.com/ampersandjs/ampersand-registry/issues"},"license":"MIT","readmeFilename":"README.md","users":{}}