{"_id":"telescope","_rev":"12-c69934f08788aa61830d857c33ed256a","name":"telescope","description":"An observable module for objects and arrays","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"telescope","description":"An observable module for objects and arrays","version":"0.1.0","homepage":"https://github.com/parroit/telescope","author":{"name":"parroit","email":"andrea.parodi@ebansoftware.net"},"repository":{"type":"git","url":"git://github.com/parroit/telescope.git"},"bugs":{"url":"https://github.com/parroit/telescope/issues"},"licenses":[{"type":"MIT","url":"https://github.com/parroit/telescope/blob/master/LICENSE-MIT"}],"main":"lib/telescope","engines":{"node":">= 0.10.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt":"~0.4.1","grunt-mocha-test":"~0.7.0","expect.js":"~0.2.0","grunt-contrib-watch":"~0.5.3"},"keywords":[],"dependencies":{"lodash":"~2.4.1"},"_id":"telescope@0.1.0","dist":{"shasum":"d8c62113b29956123412742e5830a8942fc96d51","tarball":"https://registry.npmjs.org/telescope/-/telescope-0.1.0.tgz","integrity":"sha512-Y93IvrHTMFem6u0sSODaJoNIorq+eYGFZ3JXocbs+XEfRCKRhnix+RM6aqsJ9SmXC1u9MYvnOtNU99a7j6qdDA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEHPLELvzemou5Hr8tgsgx91cjOaLutMV1tkbdiD9CySAiEAgqcP5K4mJp+EDuFR+9P5Jo4BjlSBvnw9RQxSrX5B5II="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"parroit","email":"andrea.parodi@ebansoftware.net"},"maintainers":[{"name":"parroit","email":"andrea.parodi@ebansoftware.net"}]},"0.2.0":{"name":"telescope","description":"An observable module for objects and arrays","version":"0.2.0","homepage":"https://github.com/parroit/telescope","author":{"name":"parroit","email":"andrea.parodi@ebansoftware.net"},"repository":{"type":"git","url":"git://github.com/parroit/telescope.git"},"bugs":{"url":"https://github.com/parroit/telescope/issues"},"licenses":[{"type":"MIT","url":"https://github.com/parroit/telescope/blob/master/LICENSE-MIT"}],"main":"lib/telescope","engines":{"node":">= 0.10.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt":"~0.4.1","grunt-mocha-test":"~0.7.0","expect.js":"~0.2.0","grunt-contrib-watch":"~0.5.3"},"keywords":[],"dependencies":{"lodash":"~2.4.1"},"_id":"telescope@0.2.0","dist":{"shasum":"aa262735eaad13e49cd15fbc530b28aa0f0c6602","tarball":"https://registry.npmjs.org/telescope/-/telescope-0.2.0.tgz","integrity":"sha512-a/lNIlSyXFRlsClcA4v4TlgqhMA3xYVpSZmbVQUG+QGROFLNEgZLjuUUGNzKsJiiFd2AejsKBXv3Z32GauDFJw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB8WAtdBIeRPbCTrqU6C2sCBOyf7gc+y4NNBtCLWYEnXAiEAhgeg6930OP8ishjwDb0149MLp9EauZ28QCwK3eWCpYE="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"parroit","email":"andrea.parodi@ebansoftware.net"},"maintainers":[{"name":"parroit","email":"andrea.parodi@ebansoftware.net"}]}},"readme":"# telescope\r\n[![Build Status](https://secure.travis-ci.org/parroit/telescope.png?branch=master)](http://travis-ci.org/parroit/telescope)  [![Npm module](https://badge.fury.io/js/telescope.png)](https://npmjs.org/package/telescope) [![Code Climate](https://codeclimate.com/github/parroit/telescope.png)](https://codeclimate.com/github/parroit/telescope)\r\n\r\nAn observable module for objects and arrays\r\n\r\n## Getting Started\r\nInstall the module with: `npm install telescope --save`\r\n\r\n### To create an array observable:\r\n\r\n```javascript\r\nmakeArrayObservable = require(\"telescope\").array;\r\n\r\nvar tabs = [],\r\n    observableTabs = makeArrayObservable();\r\n\r\nobservableTabs.init(tabs);\r\n```\r\n\r\n`observableTabs` is an array that emits events on push or remove of items.\r\n\r\nWhen you push or remove items to observableTabs, they are pushed or removed from tabs array,\r\nplus a \"changed\" event is emitted.\r\n\r\nPushing method create also an object observable on pushed item,\r\nthat is returned from the function.\r\n\r\n\r\n### To create an object observable:\r\n\r\n```javascript\r\n    var Observable = require(\"telescope\").object;\r\n\r\n    function ConcreteObservable(observed){\r\n        this.init(observed);\r\n    }\r\n    ConcreteObservable.prototype = new Observable();\r\n\r\n    var anObject = {\r\n       field1:1,\r\n       field2:2\r\n    };\r\n    var observable = new ConcreteObservable(anObject);\r\n```\r\n\r\n`observable` is now an object that wrap `anObject` and create a\r\nproperty for each of its property.\r\n\r\nThese property set and get values of corresponding `anObject` property,\r\nemitting \"changed\" events when property values are set.\r\n\r\nThe init pattern allow to setup derived property that\r\nare set on main property change, e.g. sum, totals, etc.\r\n\r\n\r\n## Examples\r\nSee test folder for more usage exmaples\r\n\r\n## Contributing\r\nIn lieu of a formal styleguide, take care to maintain the existing coding style.\r\nAdd unit tests for any new or changed functionality.\r\n\r\n\r\n## License\r\nCopyright (c) 2013 parroit  \r\nLicensed under the MIT license.\r\n","maintainers":[{"name":"parroit","email":"andrea.parodi@ebansoftware.net"}],"time":{"modified":"2022-06-27T04:33:33.812Z","created":"2013-12-10T20:02:54.489Z","0.1.0":"2013-12-10T20:02:58.805Z","0.2.0":"2013-12-22T09:21:45.992Z"},"author":{"name":"parroit","email":"andrea.parodi@ebansoftware.net"},"repository":{"type":"git","url":"git://github.com/parroit/telescope.git"},"users":{"parroit":true},"readmeFilename":"README.md"}