{"_id":"jjs","_rev":"29-ee3fa92af2ff6bfb03803f4549335fb5","name":"jjs","description":"jj - A javascript framework flexible like jam!","dist-tags":{"latest":"0.1.8"},"versions":{"0.1.0":{"name":"jjs","version":"0.1.0","description":"jj - A javascript framework flexible like jam!","repository":{"type":"git","url":"https://github.com/mellors/jj.git"},"main":"main.js","author":{"name":"Marcel Mellor"},"license":"BSD","dependencies":{},"bugs":{"url":"https://github.com/mellors/jj/issues"},"_id":"jjs@0.1.0","dist":{"shasum":"49edb00163bcc72a94c47963bb98be46e5cd7c26","tarball":"https://registry.npmjs.org/jjs/-/jjs-0.1.0.tgz","integrity":"sha512-Gti3HLauUf4U+DELU6XKVyBZs0pmwJcIheIt+7EYy1XYsqQgEzounXaBvXHWTtQ5N7US0+FWPuvHHIeffUqIFg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF7m5VOQK19v7BeugjRxjak+A51wxmzWgwjuq+gwFemGAiEA3anZwCYnazOnfmPOQXa6Uz8D3inBMk5jhRzd1k6Lyo4="}]},"_from":"jj/","_npmVersion":"1.2.23","_npmUser":{"name":"mellors","email":"info@mellors.de"},"maintainers":[{"name":"mellors","email":"info@mellors.de"}]},"0.1.1":{"name":"jjs","version":"0.1.1","description":"jj - A javascript framework flexible like jam!","repository":{"type":"git","url":"https://github.com/mellors/jj.git"},"main":"main.js","author":{"name":"Marcel Mellor"},"license":"BSD","dependencies":{},"bugs":{"url":"https://github.com/mellors/jj/issues"},"_id":"jjs@0.1.1","_from":".","dist":{"shasum":"9dd74ecbf1f4607755cc0207e1f67723f5d09ef8","tarball":"https://registry.npmjs.org/jjs/-/jjs-0.1.1.tgz","integrity":"sha512-lo49efnttC81OnPFSbdMcXMYQ2Fh3NvShGTXeAYvzhloAst+mrgILanlbxTUOz6Ytg5pFFjbNjb7259/8GM59w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEKWEmtgF7Oal0coYBRLpnwOrnzUZqENTVtlx1AwzTfAAiEAs/a/xvNlbG1wySB62/Z4PrbJrqkPeHH2BBQaPA5YFUs="}]},"_npmVersion":"1.2.23","_npmUser":{"name":"mellors","email":"info@mellors.de"},"maintainers":[{"name":"mellors","email":"info@mellors.de"}]},"0.1.2":{"name":"jjs","version":"0.1.2","description":"jj - A javascript framework flexible like jam!","repository":{"type":"git","url":"https://github.com/mellors/jj.git"},"main":"main.js","author":{"name":"Marcel Mellor"},"license":"BSD","dependencies":{},"bugs":{"url":"https://github.com/mellors/jj/issues"},"_id":"jjs@0.1.2","_from":".","dist":{"shasum":"d50f8aaa79c46807cdb039f23c5ab4ecd7b94054","tarball":"https://registry.npmjs.org/jjs/-/jjs-0.1.2.tgz","integrity":"sha512-bszTdcdz4gEVlqUrnoTK94ZhQyGVxEVkMS90+4c+Ri4EeYun2opzFep1qY48/tuch9oxmACT37F5LKdYO/RctA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDp/uN13fBfcbEDTM2QKH3BtyWcntzvXyZwySoyx+y6bwIhAPHDW/POkis4dir2Pj+PENKywhhyuoszQ8wFfeFtTWT6"}]},"_npmVersion":"1.2.23","_npmUser":{"name":"mellors","email":"info@mellors.de"},"maintainers":[{"name":"mellors","email":"info@mellors.de"}]},"0.1.3":{"name":"jjs","version":"0.1.3","description":"jj - A javascript framework flexible like jam!","repository":{"type":"git","url":"https://github.com/mellors/jj.git"},"main":"main.js","author":{"name":"Marcel Mellor"},"license":"BSD","dependencies":{},"bugs":{"url":"https://github.com/mellors/jj/issues"},"_id":"jjs@0.1.3","_from":".","dist":{"shasum":"f56482bf06e642ab7197a6365f091ede9ef2b7be","tarball":"https://registry.npmjs.org/jjs/-/jjs-0.1.3.tgz","integrity":"sha512-zNzNgKa6vQszymkvcwgXGle4/uj849/M7GeB5BBlUgYDa6xOzeJpFT3fxxrMTT0hnqWshbopJVvgOrJzQCOWwg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBcUvs4MHS4acIO0JQp5EH0PeeC/8PY/emCieWfe+j0lAiA3swgeXrMU7qymwoBEnf/96nZPRRcTLDpp077Hp5oVoA=="}]},"_npmVersion":"1.2.23","_npmUser":{"name":"mellors","email":"info@mellors.de"},"maintainers":[{"name":"mellors","email":"info@mellors.de"}]},"0.1.4":{"name":"jjs","version":"0.1.4","description":"jj - A javascript framework flexible like jam!","repository":{"type":"git","url":"https://github.com/mellors/jj.git"},"main":"main.js","author":{"name":"Marcel Mellor"},"license":"BSD","dependencies":{},"bugs":{"url":"https://github.com/mellors/jj/issues"},"_id":"jjs@0.1.4","_from":".","dist":{"shasum":"a0caf896f67f7d2f0bbb8dd4bf1a2a7e11219896","tarball":"https://registry.npmjs.org/jjs/-/jjs-0.1.4.tgz","integrity":"sha512-xF4JhHEfNANsYGa99WWOLVobHUsR+TkgnRGnUdgEhyN25A1O9eRcSTZ66YpQEoJdpo2Ypa/IzZ6mHTYYmY3WWA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDLvP8kUcsF6VtTl7pGBHu/hnDk4p5th3bYXc8ADKvFgwIhAK56jjjE3PBv41qki94f2ggkK6fbRnuf1eaRuPpTCqyM"}]},"_npmVersion":"1.2.23","_npmUser":{"name":"mellors","email":"info@mellors.de"},"maintainers":[{"name":"mellors","email":"info@mellors.de"}]},"0.1.5":{"name":"jjs","version":"0.1.5","description":"jj - A javascript framework flexible like jam!","repository":{"type":"git","url":"https://github.com/mellors/jj.git"},"main":"main.js","author":{"name":"Marcel Mellor"},"license":"BSD","dependencies":{},"bugs":{"url":"https://github.com/mellors/jj/issues"},"_id":"jjs@0.1.5","_from":".","dist":{"shasum":"4467462fe7e994c6a113e75795c9a28d411fd907","tarball":"https://registry.npmjs.org/jjs/-/jjs-0.1.5.tgz","integrity":"sha512-fQrEUWSqqHnt+UDJ93CqrB5tGmKoyPyBAct/0y0J0hVQ5sQcugzIzhs/emVDTS+W/h3dqaiSgqDI/KcKreoE5Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFfiHZyX0DjqikEpxypuUeETDI5bWBmkfhdmQIf+lr3LAiB5TvyfwAbPzh4olAfDuJllJhUcKZzb9KVWFXHUK3lk3Q=="}]},"_npmVersion":"1.2.23","_npmUser":{"name":"mellors","email":"info@mellors.de"},"maintainers":[{"name":"mellors","email":"info@mellors.de"}]},"0.1.7":{"name":"jjs","version":"0.1.7","description":"jj - A javascript framework flexible like jam!","repository":{"type":"git","url":"https://github.com/mellors/jj.git"},"main":"main.js","author":{"name":"Marcel Mellor"},"license":"BSD","dependencies":{},"bugs":{"url":"https://github.com/mellors/jj/issues"},"_id":"jjs@0.1.7","_from":".","dist":{"shasum":"e2d4a2e24c1cb8dd3984bff9581577035fba222d","tarball":"https://registry.npmjs.org/jjs/-/jjs-0.1.7.tgz","integrity":"sha512-yvH2onvJjiP8O0kL8JMUduZj/MI7reJtIwUMfsysRvjc/9/LZTvNkGDXeeTvajrsQFqlmkghzPEBGCyNr6gMxw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA/MOn9SMjgmFaEtfoGu5WEB+qj0qXFFBKweRPxdqPZaAiBSAzTLbzUjf05PIe+fyzDGnQwebL7t5vqghEjfua1b8Q=="}]},"_npmVersion":"1.2.23","_npmUser":{"name":"mellors","email":"info@mellors.de"},"maintainers":[{"name":"mellors","email":"info@mellors.de"}]},"0.1.8":{"name":"jjs","version":"0.1.8","description":"jj - A javascript framework flexible like jam!","repository":{"type":"git","url":"https://github.com/mellors/jj.git"},"main":"main.js","author":{"name":"Marcel Mellor"},"license":"BSD","dependencies":{},"bugs":{"url":"https://github.com/mellors/jj/issues"},"_id":"jjs@0.1.8","_from":".","dist":{"shasum":"2b7261d8066320300e1103139939508c2d9e68ed","tarball":"https://registry.npmjs.org/jjs/-/jjs-0.1.8.tgz","integrity":"sha512-VkXnDHgVUWvWPy2DMFfUPG5QX6moQPFxwy53Dg4WmT9F41P2OQYugLypDKOoq9bpNaKL6fc6lKutX5mOeIvPbA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCCFFqXpuCCWpEB9xaoyIOwsJWY3a6kGB+TfDxms5XzGwIhAPpOohIW+FOwWRRgKS4eRVzHpKWXx97F8aEiQn1e2/OH"}]},"_npmVersion":"1.2.23","_npmUser":{"name":"mellors","email":"info@mellors.de"},"maintainers":[{"name":"mellors","email":"info@mellors.de"}]}},"readme":"# jj ##\r\n\r\nA flexible javascript framework\r\n\r\njj is a small javascript frameworks, which uses some unique features of javascript (the class-free, prototypal nature, object references etc.), to give you a fast boilerplate for writing elegant code. It helps, to avoid any pollution of the global namespace by giving you a powerful registry. Furthermore, jj provides you with a flexible way to deal with objects through useful utilities for dealing, creating and copying object in a way, that's fun and the \"real\" javascript way.\r\nYou can use almost every of your favourite module as jj plugin. The core itself has no dependencies.\r\n\r\n##Quick Example##\r\n\r\n```js\r\njj.setPlugin('foo', {\r\n  test : function(){\r\n    console.log(this.get('test');\r\n  },\r\n  setGreeting: function(greeting){\r\n    this.get('global').set('greeting', greeting);\r\n  }\r\n);\r\n\r\njj.setPlugin('bar', {\r\n  init: function(){\r\n    this.trigger('greet');\r\n  }\r\n)\r\n\r\nvar foo = jj.foo().\r\n  set('test', 'Local registry entry').\r\n  test();\r\n//output \"Local registry entry\"\r\n\r\nfoo.setGreeting('Hello world!');  \r\n\r\njj.bar().on('greet', function(){\r\n  console.log('Bar says: ' + this.get('global').get('greeting');\r\n});\r\n//output \"Bar says: Hello world!\"\r\n\r\n```\r\n\r\n##Why another framework?##\r\n\r\nFor many years, the usual way to create \"class like\" objects has been, to create a constructor function, add methods to the function's `prototype` property, and then use the `new` operator for creating a new \"instance\". The advantage of this strategy is clearly, that most developers are familiar with class based languages and the learning curve is steep. The drawback has been exactly described by [Keith Peters](http://www.adobe.com/devnet/html5/articles/javascript-object-creation.html):\r\n> JavaScript is not a class-based language, but a prototype-based one. Code reuse is done not by making class templates that are used to instantiate objects, but by creating new objects directly, and then making other new objects based on existing ones.\r\n\r\nNot only does the constructor approach hide the prototypal nature of javascript, but also the power and simplicity of prototypes. To use objects, not classes, for inheritance is - from my point of view - a strategey which fits perfectly to javascript and the code, we are writing with it. The ECMAScript 5th Edition [Object.create](http://es5.github.io/#x15.2.3.5) made it very simple, to create new objects based on prototypes. \r\n\r\nOf course there are same pitfalls. For instance, if your object has other object as properties and you use it as prototype, editing the properties in the newly created one will also change the properties in the original object, because they are just references.\r\njj will help you. It makes heavy use of Object.create for superfast, memory-saving \"copying\"  and editing of objects, but eliminates the known problems. You don't have to write obj.prototype ever again!\r\n\r\n\r\n## API ##\r\n\r\n### Registry ###\r\n\r\njj gives you a simple registry, to hold your objects and plugins.\r\n\r\n##\r\n\r\n<a name=\"set\" />\r\n### set(name, value, global)\r\n\r\nSets a value to the registry\r\n\r\n__Arguments__\r\n\r\n* name - String as registry key\r\n* value - An object\r\n* global - A boolean, which indicates, if you want to add the entry to the global registry. Default to false.\r\n\r\n__Example__\r\n\r\n```js\r\njj.setPlugin('foo', {});\r\n\r\n//Set to global registry\r\njj.set('movie', 'E.T.');\r\njj.foo().set('movie', 'Jurassic Parc', true);\r\njj.get('movie'); //Output \"Jurassic Parc\"\r\n\r\n//Set to local registry\r\njj.set('movie', 'E.T.');\r\njj.foo().set('movie', 'Jurassic Parc');\r\njj.get('movie'); //Output \"E.T.\"\r\n```\r\n\r\n### Plugins ###\r\n\r\n---------------------------------------\r\n\r\n<a name=\"forEachSeries\" />\r\n### setPlugin(name, object)\r\n\r\nSet an object as jj plugin.. \r\n\r\n__Example__\r\n\r\n```js\r\njj.setPlugin('myPlugin', {\r\n  getBar : function(){\r\n    return this.get('bar');\r\n  },\r\n  foo : function(){\r\n    console.log('foo method executed');\r\n  }\r\n);\r\n\r\njj.myPlugin().foo();\r\n//console.log = 'foo method executed';\r\n```\r\n\r\nIf you set a constructor function, jj will create a new instance.\r\n\r\n```js\r\njj.setPlugin('request', XMLHttpRequest);\r\n\r\nvar request = jj.request();\r\nrequest.open('https://github.com/mellors/jj');\r\nrequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')\r\n```\r\n\r\njj is every plugins prototype. So, you can mix native methods with methods of your plugin.\r\n\r\n```js\r\nvar bar = jj.\r\n  myPlugin().\r\n  set('moview', 'E.T.').\r\n  getBar();\r\n//bar = 'A new value';\r\n```\r\n\r\nIf you set a plugin globally (via jj.setPlugin), you can use it in other plugins as well.\r\n\r\n```js\r\njj.setPlugin('secondPlugin', {\r\n  getMovie : function(){\r\n    return this.get('movie');\r\n  }\r\n);\r\n\r\nvar moview = jj.\r\n  myPlugin().\r\n  set('moview', 'Jurassic Park').\r\n  secondPlugin().\r\n  myPlugin().\r\n  getMoview();\r\n\r\n//moview = 'Jurassic Parm';\r\n```\r\n\r\n### Registry ###\r\n\r\n\r\n\r\n---------------------------------------\r\n\r\n<a name=\"forEachSeries\" />\r\n<a name=\"eachSeries\" />\r\n### set(name, object, local)\r\n\r\nVia jj.set you can add an entry to the registry of jj. \r\n\r\n\r\n---------------------------------------\r\n","maintainers":[{"name":"mellors","email":"info@mellors.de"}],"time":{"modified":"2022-06-19T04:31:36.910Z","created":"2013-11-03T10:46:51.727Z","0.1.0":"2013-11-03T10:46:55.579Z","0.1.1":"2014-01-02T16:44:12.548Z","0.1.2":"2014-01-22T08:47:32.054Z","0.1.3":"2014-01-31T13:28:58.058Z","0.1.4":"2014-02-11T13:46:58.433Z","0.1.5":"2014-02-24T21:17:13.035Z","0.1.7":"2014-04-12T18:12:29.285Z","0.1.8":"2014-06-16T14:35:08.191Z"},"author":{"name":"Marcel Mellor"},"repository":{"type":"git","url":"https://github.com/mellors/jj.git"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/mellors/jj/issues"},"license":"BSD"}