{"_id":"@adzadzadz/global-variable","_rev":"1-4cba292a99b6d00766d3df3e8f0ccd0c","name":"@adzadzadz/global-variable","dist-tags":{"alpha":"3.0.1-alpha","latest":"3.0.1-alpha"},"versions":{"3.0.1-alpha":{"description":"Polymer element that allows share data between non-relatives elements.","name":"@adzadzadz/global-variable","version":"3.0.1-alpha","resolutions":{"inherits":"2.0.3","samsam":"1.1.3","supports-color":"3.1.2","type-detect":"1.0.0"},"main":"global-variable.js","dependencies":{"@polymer/polymer":"^3.1.0"},"devDependencies":{"@polymer/iron-component-page":"^4.0.1","@polymer/iron-demo-helpers":"^3.0.2","@polymer/paper-input":"^3.0.1","@webcomponents/webcomponentsjs":"^2.2.1","wct-browser-legacy":"^1.0.1"},"licenseText":"MIT License\n\nCopyright (c) 2017 Rodrigo Sancho Moya (https://github.com/trofrigo)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","license":"MIT","_id":"@adzadzadz/global-variable@3.0.1-alpha","dist":{"shasum":"eae9eef2ce2f14b6787c093ebbd92cb8d6eee654","integrity":"sha512-Zm/YHAKdyMWqIMeD8gHu1pJTuPRtt+GF7M6z0NrV3b8j8mDK9u6LDXd0P2e5SesQyaBWfC3fNohWikHeRfq/UA==","tarball":"https://registry.npmjs.org/@adzadzadz/global-variable/-/global-variable-3.0.1-alpha.tgz","fileCount":17,"unpackedSize":29521,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcJYeECRA9TVsSAnZWagAApvgP/j31AWCuSlVAm6epsmE2\nmTWCwFIDmhFrdkPTUiYHXi0eGJJojia5FvhNs3RdF/MqpmckxWwwwOBw32M2\nlP0j3O1Mt5gKBtp6Q9I6BTSI4p5IEqQZRuLBcDOm0nbZqQ9+ucREZCIKo5pk\nqhKf2MDoJmxZ/fp4GxRNz7xKH6N0UxridQTZYy9HBQ1gICLyB9r4K0C1r/KS\nXzGNSc+g9+i4KzeDDnkJlN5YwNfu9lCjrI/boKiwiO50icpNwN37Q9cEWTKK\nAkz0DbJQ1bVPsU5YhpqAUkfJc473qb8aHj2AjKhg0dsbK9yCUjvnSAsz478U\nxHKMl6yQzJ4DzPzEN37D2DivEBYmDZSaI0yxEmaFyggjExvikYap73/fnXbI\nh21dOzsoo+NFiiRhhjKzujKhrONzI6whl0h+IFR8giR3crNkBg4RQyYEaJCm\nBBw3zE5Y14kYhZByS3yf05t7O3P+XVt/9/fmaYU1MojKxIMlX/YrO1YG8trT\n8m4HiPePS99NJPOsjLAvyZLjCmURGReV0MjHp8EqWucCAqKhtAFNtOGN3hRw\nCidx4+I+Lh7drodywoDkhbMYtUmBrY7IwAlapvswVE4Zf4g6N8bGgcFgQ20D\nuT7/Asjab7111Tz/bYxUlEQx69BK0eLXU4C3ushmKw0n7psl5t8D5uUEXWdT\nRQ6N\r\n=ML+b\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDnZ084rwZeSrFcYJjK26eiL9C1Cvb1xvCIENd7/Nj+HwIgMtPxiQ59FoocW8GblGCRe7C+FS+RYEpRzXOsye0ZWGI="}]},"maintainers":[{"name":"adzadzadz","email":"adzbite@gmail.com"}],"_npmUser":{"name":"adzadzadz","email":"adzbite@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/global-variable_3.0.1-alpha_1545963395672_0.6832019711523627"},"_hasShrinkwrap":false}},"time":{"created":"2018-12-28T02:16:35.497Z","3.0.1-alpha":"2018-12-28T02:16:35.810Z","modified":"2022-04-04T11:46:42.795Z"},"maintainers":[{"name":"adzadzadz","email":"adzbite@gmail.com"}],"description":"Polymer element that allows share data between non-relatives elements.","license":"MIT","readme":"[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/trofrigo/global-variable)\n\n# \\<global-variable\\> v0.1.4\n\n[Polymer](https://www.polymer-project.org/1.0/) element that allows share data between non-relatives elements.\n\nCan be used as a [Polymer v1 element](https://www.polymer-project.org/1.0/docs/devguide/feature-overview) or a [Polymer hybrid mode element](https://www.polymer-project.org/2.0/docs/devguide/hybrid-elements).\n\n## Demo\n<!--\n```\n<custom-element-demo>\n  <template>\n    <script src=\"../webcomponentsjs/webcomponents-lite.min.js\"></script>\n    <link rel=\"import\" href=\"global-variable.html\">\n    <link rel=\"import\" href=\"../paper-input/paper-input.html\">\n    <template is=\"dom-bind\">\n        <next-code-block></next-code-block>\n    </template>\n  </template>\n</custom-element-demo>\n```\n-->\n```html\n\n  <global-data on-set=\"_onSet\"\n               on-subscribe=\"_onSubscribe\"\n               on-unsubscribe=\"_onUnsubscribe\">\n  </global-data>\n              \n\n  <global-variable key=\"input\" \n                   value=\"{{ inputElement1 }}\">\n  </global-variable>\n  <paper-input label=\"Element 1\"\n               value=\"{{ inputElement1 }}\">\n  </paper-input>\n  <global-variable key=\"input\" \n                   value=\"{{ inputElement2 }}\">\n  </global-variable>\n  <paper-input label=\"Element 2\"\n               value=\"{{ inputElement2 }}\">\n  </paper-input>\n  <global-variable key=\"input\" \n                   value=\"{{ inputElement3 }}\" \n                   readonly>\n  </global-variable>\n  <paper-input label=\"Element 3\"\n               value=\"{{ inputElement3 }}\">\n  </paper-input>\n```\n\n## Installation\n\nTo add this element to your project:\n\n    bower i trofrigo/global-variable --save\n\n## Usage\n\nYou can instance this element as many times as you desire. \nEvery time that an instance's `value` is modified, it will be propagated to the rest of the \ninstances of this element with the same `key`.\n```html\n  <global-variable key=\"input\" \n                   value=\"{{ inputElement1 }}\">\n  </global-variable>\n  <paper-input label=\"Element 1\"\n               value=\"{{ inputElement1 }}\">\n  </paper-input>\n\n  <global-variable key=\"input\" \n                   value=\"{{ inputElement2 }}\">\n  </global-variable>\n  <paper-input label=\"Element 2\"\n               value=\"{{ inputElement2 }}\">\n  </paper-input>\n```\nBoth input will show the same value.\n\nIn addition, you can use the `readonly` property. This property allows to receive any change in the path and prevents any value \npropagation form this instance to the others.\n \nThere is a second element, `<global-data></global-data>`,  that works as an API for the storage with two methods, \n`set(path, value)` and `get(path)`. This element will, as well, fire events every time that a path's value changes, \nan element subscribe to a path or an element unsubscribe from a path. \n```html    \n    <global-data id=\"globalData\"\n                 on-set=\"_onSet\"\n                 on-subscribe=\"_onSubscribe\"\n                 on-unsubscribe=\"_onUnsubscribe\">\n    </global-data>\n    \n    <global-variable key=\"input\" \n                     value=\"{{ inputElement1 }}\">\n    </global-variable>\n    <paper-input label=\"Element 1\"\n                 value=\"{{ inputElement1 }}\">\n    </paper-input>\n    \n    <script>\n          var data = document.querySelector('#globalData');\n          console.log(data.get('input')); //Will show paper-input's value\n    </script>  \n    \n ```\n \n## Changelog\n### v0.1.4\n* Fixed Issue #4. Removed the `reflectToAttribute` on `value` property.\n### v0.1.3\n* Fixed Issue #3. <global-variable> was not initializing the `value` in the `subscribe` method.\n### v0.1.2\n* Added a new element, <global-data>, that allows to access to the core's API, \nand fires events every time that an element subscribes or unsubscribes to a path \nor every time that path's value is modified.\n* Encapsulating all the logic into a new core library.\n### v0.1.1\n* Fixed some errors in the README.md file\n### v0.1.0\n* First version of the element.\n \n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## License\n\nCopyright (c) 2017 Rodrigo Sancho\n\nLicensed under the [MIT license](https://github.com/trofrigo/global-variable/blob/master/LICENSE).\n","readmeFilename":"README.md"}