{"_id":"@aedart/js-facade","_rev":"8-6b0fb775e6046c2fcf0deef95ffb75e6","name":"@aedart/js-facade","description":"Static interface to concrete classes via an IoC Service Container","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@aedart/js-facade","version":"1.0.0","description":"Static interface to concrete classes via an IoC Service Container","main":"index.js","scripts":{"test":"karma start karma.conf.js"},"repository":{"type":"git","url":"git+https://github.com/aedart/js-facade.git"},"keywords":["facade","dependency","proxy"],"author":{"name":"Alin Eugen Deac","email":"aedart@gmail.com","url":"https://github.com/aedart"},"license":"BSD-3-Clause","bugs":{"url":"https://github.com/aedart/js-facade/issues"},"homepage":"https://github.com/aedart/js-facade#readme","dependencies":{},"devDependencies":{"@aedart/js-ioc":"^0.9.0","babel-plugin-external-helpers":"^6.18.0","babel-plugin-transform-builtin-extend":"^1.1.0","babel-preset-es2015-rollup":"^1.2.0","faker":"^3.1.0","jasmine":"^2.5.2","karma":"^1.3.0","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.0","karma-ie-launcher":"^1.0.0","karma-jasmine":"^1.0.2","karma-phantomjs-launcher":"^1.0.2","karma-rollup-plugin":"^0.2.4","karma-spec-reporter":"0.0.26","rollup":"^0.36.3","rollup-plugin-babel":"^2.6.1","rollup-plugin-buble":"^0.14.0","rollup-plugin-commonjs":"^5.0.5","rollup-plugin-eslint":"^3.0.0","rollup-plugin-node-builtins":"^2.0.0","rollup-plugin-node-globals":"^1.0.9","rollup-plugin-node-resolve":"^2.0.0","rollup-plugin-replace":"^1.1.1","rollup-plugin-uglify":"^1.0.1","uglify-js-harmony":"^2.6.2"},"gitHead":"a0f81831f26c4cc694ff83e1c9277b54c3a50f2f","_id":"@aedart/js-facade@1.0.0","_shasum":"dcb25e09c69afb6ec743ff8ddbbf5a2c7b98dff3","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"aedart","email":"aedart@gmail.com"},"dist":{"shasum":"dcb25e09c69afb6ec743ff8ddbbf5a2c7b98dff3","tarball":"https://registry.npmjs.org/@aedart/js-facade/-/js-facade-1.0.0.tgz","integrity":"sha512-5d0pmquBx58ltHCGQypTeT68m1y5WgKqi30lrQo+1SIr7vceXc8rPaHVUkjNipnF7FODBEdmu78NMRbUl0MhtA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAjWPzfV+oBjntmPax/2ygkReFSC1p/0VwvsALeFGoM4AiAjydYhTU0NkhXblLZUPHTvbM/gDvid17/+ijMIOPA2Tg=="}]},"maintainers":[{"name":"aedart","email":"aedart@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/js-facade-1.0.0.tgz_1478336729578_0.9085370551329106"},"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.1":{"name":"@aedart/js-facade","version":"1.0.1","description":"Static interface to concrete classes via an IoC Service Container","main":"index.js","scripts":{"test":"karma start karma.conf.js"},"repository":{"type":"git","url":"git+https://github.com/aedart/js-facade.git"},"keywords":["facade","dependency","proxy"],"author":{"name":"Alin Eugen Deac","email":"aedart@gmail.com","url":"https://github.com/aedart"},"license":"BSD-3-Clause","bugs":{"url":"https://github.com/aedart/js-facade/issues"},"homepage":"https://github.com/aedart/js-facade#readme","dependencies":{},"devDependencies":{"@aedart/js-ioc":"^0.9.0","babel-plugin-external-helpers":"^6.18.0","babel-plugin-transform-builtin-extend":"^1.1.0","babel-preset-es2015-rollup":"^1.2.0","faker":"^3.1.0","jasmine":"^2.5.2","karma":"^1.3.0","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.0","karma-ie-launcher":"^1.0.0","karma-jasmine":"^1.0.2","karma-phantomjs-launcher":"^1.0.2","karma-rollup-plugin":"^0.2.4","karma-spec-reporter":"0.0.26","rollup":"^0.36.3","rollup-plugin-babel":"^2.6.1","rollup-plugin-buble":"^0.14.0","rollup-plugin-commonjs":"^5.0.5","rollup-plugin-eslint":"^3.0.0","rollup-plugin-node-builtins":"^2.0.0","rollup-plugin-node-globals":"^1.0.9","rollup-plugin-node-resolve":"^2.0.0","rollup-plugin-replace":"^1.1.1","rollup-plugin-uglify":"^1.0.1","uglify-js-harmony":"^2.6.2"},"gitHead":"87ceb4ba50bdc459bf0fee7bf67133a88bd54418","_id":"@aedart/js-facade@1.0.1","_shasum":"64cc938f932845c142b8303aa4f0faced70fb803","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"aedart","email":"aedart@gmail.com"},"dist":{"shasum":"64cc938f932845c142b8303aa4f0faced70fb803","tarball":"https://registry.npmjs.org/@aedart/js-facade/-/js-facade-1.0.1.tgz","integrity":"sha512-usQlDj/TjXNT8RZSAiysyAY/0gZ2ulRqYbTanLBwA4BXzlwGDLDi9YRradDEn3NfYIRnhpUBmnhNRldGxeW65g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBC1JNh3SNSMCrqoTYKDLjqXMwzBk5Q9sHYexjApjkD9AiAtCm0NtOlj9RA9fWE9LzEO1rNjaOU7OtFdfsQ+F3jpoA=="}]},"maintainers":[{"name":"aedart","email":"aedart@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/js-facade-1.0.1.tgz_1478940754593_0.43714393582195044"},"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.1.0":{"name":"@aedart/js-facade","version":"1.1.0","description":"Static interface to concrete classes via an IoC Service Container","main":"index.js","scripts":{"test":"karma start karma.conf.js"},"repository":{"type":"git","url":"git+https://github.com/aedart/js-facade.git"},"keywords":["facade","dependency","proxy"],"author":{"name":"Alin Eugen Deac","email":"aedart@gmail.com","url":"https://github.com/aedart"},"license":"BSD-3-Clause","bugs":{"url":"https://github.com/aedart/js-facade/issues"},"homepage":"https://github.com/aedart/js-facade#readme","dependencies":{},"devDependencies":{"@aedart/js-ioc":"^0.9.0","babel-plugin-external-helpers":"^6.18.0","babel-plugin-transform-builtin-extend":"^1.1.0","babel-preset-es2015-rollup":"^1.2.0","faker":"^3.1.0","jasmine":"^2.5.2","karma":"^1.3.0","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.0","karma-ie-launcher":"^1.0.0","karma-jasmine":"^1.0.2","karma-phantomjs-launcher":"^1.0.2","karma-rollup-plugin":"^0.2.4","karma-spec-reporter":"0.0.26","rollup":"^0.36.3","rollup-plugin-babel":"^2.6.1","rollup-plugin-buble":"^0.14.0","rollup-plugin-commonjs":"^5.0.5","rollup-plugin-eslint":"^3.0.0","rollup-plugin-node-builtins":"^2.0.0","rollup-plugin-node-globals":"^1.0.9","rollup-plugin-node-resolve":"^2.0.0","rollup-plugin-replace":"^1.1.1","rollup-plugin-uglify":"^1.0.1","uglify-js-harmony":"^2.6.2"},"gitHead":"56d8d7858c43f3252dbe3fa6739e4bb537dfa776","_id":"@aedart/js-facade@1.1.0","_shasum":"f929feaa5520dd68d7692ef407ffa7a08e00c149","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"aedart","email":"aedart@gmail.com"},"dist":{"shasum":"f929feaa5520dd68d7692ef407ffa7a08e00c149","tarball":"https://registry.npmjs.org/@aedart/js-facade/-/js-facade-1.1.0.tgz","integrity":"sha512-sKCIkBXrTAhpDbiU7ysS8y4iT1JHKg0XORj+26qGNOQNtwpmJmpCYh4xfGbPjkzckbIm7NlKFZxvEYr7UJk7QQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBAhwzlxexs0X1Y3cS5uTR4YhJ1F3Buzps2XSTKMfmgTAiAOlZ5UvwbygrJc+6GklH2DPz6i53QlsL6VTCD0JwD5fA=="}]},"maintainers":[{"name":"aedart","email":"aedart@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/js-facade-1.1.0.tgz_1483876472828_0.1813752653542906"},"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.1.1":{"name":"@aedart/js-facade","version":"1.1.1","description":"Static interface to concrete classes via an IoC Service Container","main":"index.js","scripts":{"test":"karma start karma.conf.js"},"repository":{"type":"git","url":"git+https://github.com/aedart/js-facade.git"},"keywords":["facade","dependency","proxy"],"author":{"name":"Alin Eugen Deac","email":"aedart@gmail.com","url":"https://github.com/aedart"},"license":"BSD-3-Clause","bugs":{"url":"https://github.com/aedart/js-facade/issues"},"homepage":"https://github.com/aedart/js-facade#readme","dependencies":{},"devDependencies":{"@aedart/js-ioc":"^1.2.1","babel-plugin-external-helpers":"^6.18.0","babel-plugin-transform-builtin-extend":"^1.1.0","babel-preset-es2015-rollup":"^1.2.0","faker":"^3.1.0","jasmine":"^2.5.2","karma":"^1.3.0","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.0","karma-ie-launcher":"^1.0.0","karma-jasmine":"^1.0.2","karma-phantomjs-launcher":"^1.0.2","karma-rollup-plugin":"^0.2.4","karma-spec-reporter":"0.0.26","rollup":"^0.36.3","rollup-plugin-babel":"^2.6.1","rollup-plugin-buble":"^0.14.0","rollup-plugin-commonjs":"^5.0.5","rollup-plugin-eslint":"^3.0.0","rollup-plugin-node-builtins":"^2.0.0","rollup-plugin-node-globals":"^1.0.9","rollup-plugin-node-resolve":"^2.0.0","rollup-plugin-replace":"^1.1.1","rollup-plugin-uglify":"^1.0.1","uglify-js-harmony":"^2.6.2"},"gitHead":"e1aa74030b05a8abc6b6ee3c96496eb8b3fdacc5","_id":"@aedart/js-facade@1.1.1","_npmVersion":"5.0.3","_nodeVersion":"6.10.3","_npmUser":{"name":"aedart","email":"aedart@gmail.com"},"dist":{"integrity":"sha512-uKUDK4jcW808379y+VcsqjbK38jpL7uMyfpHPTJfRHqSt1V4/SfH5Ao1amlY2FgO4y3jb833gMylIX+sFUXEHQ==","shasum":"adbcdddbb137309837429faff9f2c6520900a513","tarball":"https://registry.npmjs.org/@aedart/js-facade/-/js-facade-1.1.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDraBFcH0vBAN8PG4AfYyjcG0DaiBQU4U8ptIVrxqStMQIhALuOpGOnXDlJz6nsllaP5cY92MtyvwGph5oEKOme7wdG"}]},"maintainers":[{"name":"aedart","email":"aedart@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-facade-1.1.1.tgz_1496818443980_0.3702592777553946"},"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"readme":"# Js Facade\n\nStatic interface to concrete classes via an [IoC](https://en.wikipedia.org/wiki/Inversion_of_control) Service Container.\n\nBefore you continue reading, you should know that this package is heavily inspired by [Taylor Otwell's](https://github.com/taylorotwell) [Facades](https://laravel.com/docs/master/facades) in [Laravel](https://laravel.com/).\nPlease go read the documentation, to gain a better understanding of what facades are and how they are intended to work.\n\n## Contents\n\n* [How to install](#how-to-install)\n* [Quick start](#quick-start)\n  * [Set the IoC instance](#set-the-ioc-instance)\n  * [Create a facade](#create-a-facade)\n  * [Using your facade](#using-your-facade)\n* [Contribution](#contribution)\n* [Acknowledgement](#acknowledgement)\n* [Versioning](#versioning)\n* [License](#license)\n\n\n## How to install\n\n```console\nnpm install @aedart/js-facade\n```\n\n## Quick start\n\n### Set the IoC instance\n\nThe Facade requires an [IoC](https://en.wikipedia.org/wiki/Inversion_of_control) Service Container instance, so that it can resolve the facade's accessor (a string identifier) and obtain a concrete class instance. \n\nThere is no check of kind of IoC implementation you should use. But, your IoC is required to have a `make` method; \n\n**Required Make method**\n\n```javascript\n/**\n * Resolve the registered abstract from the container\n * \n * @param {string} abstract\n * @param {Array.<*>} [parameters]\n * \n * @return {Object}\n * \n * @throw {Error}\n */\nfunction make(abstract, parameters = []){\n    // ... not shown ... //\n};\n```\n\nWhenever the make method is invoked, the facade assumes that the IoC is able to return a concrete instance or fail. \n\nAs long as your desired IoC has such a method, you can use this facade. Alternatively, you can use my [`@aedart/js-ioc`](https://www.npmjs.com/package/@aedart/js-ioc) package.\n\n**Setting IoC instance on Facade**\n\n```javascript\nimport Facade from '@aedart/js-facade';\nimport IoC from '@aedart/js-ioc';\n\n// Somewhere in you bootstrap / setup logic, set the IoC on the Facade\nFacade.ioc = IoC;\n```\n\n### Create a facade\n\nGiven that you have a concrete class, and that you somehow have registered (bound) an instance to it in your IoC;\n\n**A simple Box class**\n\n```javascript\n'use strict';\n\nclass Box {\n    set width(value){\n        // ... not shown .../\n    }\n    \n    get width(){\n        // ... not shown .../\n    }\n\n    set height(value){\n        // ... not shown .../\n    }\n    \n    get height(){\n        // ... not shown .../\n    }\n}\n\nexport default Box;\n```\n\n**A facade for the Box class**\n\n```javascript\n'use strict';\n\nimport Facade from '@aedart/js-facade';\n\nclass BoxFacade extends Facade {\n    constructor(){\n        // Accessor - MUST match the identifier you used to\n        // register your Box with, in your IoC.\n        super('my-box-identifier');\n    }\n}\n\n// You MUST export a initialised instance of this facade.\nexport default new BoxFacade();\n```\n\nBehind the scene, a [Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) is used by the facade to trap method calls. Those traps ensure to invoke the correct methods on the concrete class, via the IoC Service Container.\n\n### Using your facade\n\nWhenever you need to use your concrete class, via a facade, you simply just import it and invoke the methods or properties that you require from it. \n\n**Using BoxFacade**\n\n```javascript\n'use strict';\n\n// Import you facade from where you stored it...\nimport BoxFacade from './src/Facades/BoxFacade';\n\n// ... somewhere in your application or inside a component ... //\n\nBoxFacade.width = 25;\nBoxFacade.height = 50;\n\nconsole.log(BoxFacade.width, BoxFacade.height); // Output 25, 50 \n\n```\n\n## Contribution\n\nHave you found a defect ( [bug or design flaw](https://en.wikipedia.org/wiki/Software_bug) ), or do you wish improvements? In the following sections, you might find some useful information\non how you can help this project. In any case, I thank you for taking the time to help me improve this project's deliverables and overall quality.\n\n### Bug Report\n\nIf you are convinced that you have found a bug, then at the very least you should create a new issue. In that given issue, you should as a minimum describe the following;\n\n* Where is the defect located\n* A good, short and precise description of the defect (Why is it a defect)\n* How to replicate the defect\n* (_A possible solution for how to resolve the defect_)\n\nWhen time permits it, I will review your issue and take action upon it.\n\n### Fork, code and send pull-request\n\nA good and well written bug report can help me a lot. Nevertheless, if you can or wish to resolve the defect by yourself, here is how you can do so;\n\n* Fork this project\n* Create a new local development branch for the given defect-fix\n* Write your code / changes\n* Create executable test-cases (prove that your changes are solid!)\n* Commit and push your changes to your fork-repository\n* Send a pull-request with your changes\n* _Drink a [Beer](https://en.wikipedia.org/wiki/Beer) - you earned it_ :)\n\nAs soon as I receive the pull-request (_and have time for it_), I will review your changes and merge them into this project. If not, I will inform you why I choose not to.\n\n## Acknowledgement\n\n* [Taylor Otwell](https://github.com/taylorotwell), for his [Facade](https://laravel.com/docs/master/facades) implementation\n\n## Versioning\n\nThis package follows [Semantic Versioning 2.0.0](http://semver.org/)\n\n## License\n\n[BSD-3-Clause](http://spdx.org/licenses/BSD-3-Clause), Read the LICENSE file included in this package","maintainers":[{"name":"aedart","email":"aedart@gmail.com"}],"time":{"modified":"2023-02-16T11:36:58.311Z","created":"2016-11-05T09:05:31.343Z","1.0.0":"2016-11-05T09:05:31.343Z","1.0.1":"2016-11-12T08:52:36.662Z","1.1.0":"2017-01-08T11:54:34.930Z","1.1.1":"2017-06-07T06:54:04.949Z"},"homepage":"https://github.com/aedart/js-facade#readme","keywords":["facade","dependency","proxy"],"repository":{"type":"git","url":"git+https://github.com/aedart/js-facade.git"},"author":{"name":"Alin Eugen Deac","email":"aedart@gmail.com","url":"https://github.com/aedart"},"bugs":{"url":"https://github.com/aedart/js-facade/issues"},"license":"BSD-3-Clause","readmeFilename":"README.md"}