{"_id":"mangojuice-core","_rev":"72-526f1a651715e61457347b45d5b54b76","name":"mangojuice-core","dist-tags":{"latest":"1.2.11","next":"2.0.0-4"},"versions":{"0.1.2-beta.1":{"name":"mangojuice-core","version":"0.1.2-beta.1","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.1.2-beta.1","_npmVersion":"5.0.3","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-rgidm8PnHbLOew6uccI9MinbneXsJl12pQGQoIQdML4TgxWJvbnKtpuVA8Juc1JPm8n+rCgzy0AOV6pLYPHqYw==","shasum":"251166ad370001004a26be3b93b7b6995880f54d","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.1.2-beta.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCvNh6J5uwgCZPlKtoCq2CFh86UIzSpM7gXaLvvyIJ3gQIgb3UprVfn8Amw1gBAb+hH7a5tuRjtPJgCiRcJsd2Pjg4="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.1.2-beta.1.tgz_1499104999515_0.6254164499696344"},"directories":{}},"0.1.2":{"name":"mangojuice-core","version":"0.1.2","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.1.2","scripts":{},"_shasum":"7b4bf0419d837b1fd10fe9b1dab76bb49ad11574","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"shasum":"7b4bf0419d837b1fd10fe9b1dab76bb49ad11574","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.1.2.tgz","integrity":"sha512-TVraGxmaLi0AePrG6VCby/8EGKDZGV3Z5ZhDczR2UEjg3i+LFoNSU8bSWgcoRPgJQIrHGuqhJV/3qMcIcuDRNw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD0sv2Yt18N+EmB1Sq9whxBZKyGidSBKk8XrFtcQMtGjQIhALi2DlE3UFMdd3OiWj2WZVTMEulq+zdhmwR9rbI+Q3dZ"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.1.2.tgz_1499527723759_0.5041625178419054"},"directories":{}},"0.1.3":{"name":"mangojuice-core","version":"0.1.3","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.1.3","_npmVersion":"5.0.3","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-c91rWGJnuBwxySgNAcRTzelU/gkf3Gdu8OjZWxkJpm1Oxr7QOKngqGcQU1XWBzt+c+QG1amumF2TdwOtWqyPDg==","shasum":"72888d1b19caf03bc17a73872e854ac8ca73154a","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.1.3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCpRIclwgj2TsD0fFRw+EMBqw4f0cbmDXCT5WTdzuifgwIgPqgsr0gyR75x7sfmUu5YujejUs7Mz8E3kDu92Zrkj0o="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.1.3.tgz_1499885123614_0.4324444516096264"},"directories":{}},"0.1.4":{"name":"mangojuice-core","version":"0.1.4","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.1.4","_npmVersion":"5.0.3","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-NHd8uLIpJwA21TLReTvPE/sEMposDZCUhfBjZbFRnHWx3clWnvt1j+DDKvxxYNZBvX3rpuo3ppys9fvfuqnRqA==","shasum":"7c31b3829f04536b5bf4efb7f2d3ad59fd4c8267","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.1.4.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDx8y1qArqALzVFmQIxsyIzMHkXbek7BaS4h3ZDtdNGxAIgJOKuQJabUBNxnxFZ7MafNaVqBUnIQQnJRX95vMEhk6g="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.1.4.tgz_1500064011206_0.02867339109070599"},"directories":{}},"0.1.5":{"name":"mangojuice-core","version":"0.1.5","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.1.5","_npmVersion":"5.0.3","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-5htJivbsJtB2zr3kpjOe2jg/pynxZGK3vvgHmTwytAmSUrSVmmDnGmJvWEU6dng07ImoFOBVa8xDBTNCQBxxNw==","shasum":"f309220eca90f33b60c37bbabd1e72e0319045a5","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.1.5.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDxBgEOiU8lBGHqhGOjGMl+WKzuRiL4Yb8cBbMkRDrCeQIgOEo8izCOvVtkACb5OfXIs+8IS0aLdFTkBRz/MditWsA="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.1.5.tgz_1500065426383_0.1323647671379149"},"directories":{}},"0.1.6":{"name":"mangojuice-core","version":"0.1.6","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.1.6","_npmVersion":"5.0.3","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-/fCaxXCUPnTeQ588KBSjxD0oHZEFHPwPPIiuqDnqZkyAeV/7GhAEqFKfrAtCZY3JMe4XmgBPWDSN0BWn2IR6Yw==","shasum":"763617fd51a460610efd2b0f664fc9c486b89742","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.1.6.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCCpOlFO502v36qywVJZTHt2wXbTTumWbamXwSKyLl2DQIhAN5N+XA8OZf641Kw0bNV15//VsZmzElabv1SS84DqeT/"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.1.6.tgz_1500198112716_0.4803394500631839"},"directories":{}},"0.1.7-beta1":{"name":"mangojuice-core","version":"0.1.7-beta1","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.1.7-beta1","_npmVersion":"5.0.3","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-20+QZy7iCwACCDwumjzdf54Bm0TnmAZa8yP1Mdz/BZ6+Ni2LgKJlnJpLj0ssWTxtT7J2Xpn2dCnOcLJFoaDoaw==","shasum":"92dcebecf0eec9305317704ca17dadbb56c9d253","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.1.7-beta1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCerQJe/glCrYYUvF53ibmPQ3Q9wVKDlXC1sFD54goMOQIhAIJDe36iCf2j2OoRxyOvqoX+8aZ+XZe4nArVMexgjQi8"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.1.7-beta1.tgz_1500199560586_0.3830642562825233"},"directories":{}},"0.1.7-beta2":{"name":"mangojuice-core","version":"0.1.7-beta2","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.1.7-beta2","_npmVersion":"5.0.3","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-m6c2UOfjfVQ9nU9zaaNNVuUQ0A4ScbhrTPHykkU7PuA+a7qNPnwenHBiCkck/sjL7rEtxA18Y3erBYWZV7pK3w==","shasum":"a8fd30a3c6bb6a53ee76d1799621759a2ce8aea1","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.1.7-beta2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCeKEjuo1CbtMDJmwBBdZ4YU5w0ms1gMgRR4EHKmhQ3OgIhAJU43P/giIPt35QJK20FTtumTP3jLsNke1422Z2aO68o"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.1.7-beta2.tgz_1500378245664_0.11434064735658467"},"directories":{}},"0.2.0":{"name":"mangojuice-core","version":"0.2.0","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.0","_npmVersion":"5.3.0","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-H33/SagOrlN4TwsEeIx64Ep5hsLBTdT+3GmL8VShq0jBzehRIc4JlnIeNjVr8ihInKiyMFUrakDUwYsGQl/2kQ==","shasum":"3ccb7c7bbf70dcc10ebf7aeb5e7c3a39403bdf61","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHSd96vydJNKU++2YVjl0Z7qXY96pDlGo07Vd+6in9xjAiAnWIg013/lqgFI+p6q+xjxWziJW+yGdo98ygFFjGK1CA=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.0.tgz_1502908872121_0.5646166922524571"},"directories":{}},"0.2.1":{"name":"mangojuice-core","version":"0.2.1","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.1","_npmVersion":"5.3.0","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-RmJNCLrgAoBROB0c40cR9oFRbsyZAwCgDSRekJClJH6mNh83olBxK4frg09N496sFHQc49NW+cj9D1OPJQInvQ==","shasum":"56e5370a5420b527e9b9f1650557a842b6ddd5b8","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCvtUzgW0B5KhbeXA3i1+qUaBpApLGjWXLVE2VYV7vmaQIgUfmjAOqov3k4L8gFFOqfgQ1E3nzy4NcBiWSmsc+ZYK4="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.1.tgz_1507073617143_0.3765235042665154"},"directories":{}},"0.2.2-0":{"name":"mangojuice-core","version":"0.2.2-0","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-0","_npmVersion":"5.3.0","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-nLF9SrHimyx2lj/mzp6A0YwB5gvr40n7CEMCSk1RlYBzCZvWjH9lVLAiodSuLg0wlDlM9zs2R986BWv/0dCerw==","shasum":"f6b3b507133b2ff9b85d350b61f1d893ad78edb5","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAw0Q8A+4rNdlEJgjic81SmgrabzutQ7N5G/zR9rfoczAiBuoR3+S9z6W+ZOb2mZVmZJ3QVbehyzU5JA+ay4JxYbaQ=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-0.tgz_1507076108421_0.4999673552811146"},"directories":{}},"0.2.2-1":{"name":"mangojuice-core","version":"0.2.2-1","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-1","_npmVersion":"5.3.0","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-4zAEM67uShbUcxYQkRJ+elyu36s79cNSA1dMg6hALKRVUBsfGNYWLG0YX9t8LVEpn8jtYYctOXC9Pkz3sb66yw==","shasum":"2fbff7d62b1e68e6824357f37b41e6f568cd774c","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEyzQ92RxrqAHjdQRcvFADX2ZILHd9rn5HCLF6VVYdHgIgLWFzcBPk8KjPeUVFOIRCap5nMEVMQoJWGOWVq5Mbjcw="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-1.tgz_1507113458385_0.3267563146073371"},"directories":{}},"0.2.2-2":{"name":"mangojuice-core","version":"0.2.2-2","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-2","_npmVersion":"5.3.0","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-VaGvqO3bUsl5pAd+Whnv3TEwyxMQxQLVnNyDNQPBwCrpjhvMnw/HwNw8B2Rccd8W/b786Ag3+CZ0faknBRdeng==","shasum":"d4a2868c73ea2b5d91ccb7db84a60d7a56e845a1","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEGHeJPKZ8c18B/6VIGCNED4MNp3Nzf1J1s2B/TUkuR3AiEAindj3WRa4rfE9aVZSRbRH8sN3mHQyqlrCO6BAkxloVQ="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-2.tgz_1507114266101_0.7456174537073821"},"directories":{}},"0.2.2-3":{"name":"mangojuice-core","version":"0.2.2-3","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-3","_npmVersion":"5.3.0","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-K8udo4h9mjnoIKLl5h3yPf20Rn6gC3oavAHkgmByW8QXTxE4rM3wJzcNqUOeyu8/LkS79MSB01k9sd1rj2n19A==","shasum":"cd426f64ae649f6b4e59b067c703b85679f3cb8d","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDRIv905JaAesOKmhzeyhCv/Eovw13L4IXB8EIdcw/AGAiAw/YXHJYQ/ILvNFXWMRMeBC/hdBUyj7/jzCM4FX4sv5Q=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-3.tgz_1507115478994_0.27980096102692187"},"directories":{}},"0.2.2-4":{"name":"mangojuice-core","version":"0.2.2-4","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-4","_npmVersion":"5.3.0","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-7Qd2Dpguo5w+bRKhuJelcVAe8wHWxWZOYtw3t441yLO/582H9RN/oy4YZiFqrkhlx0H7Xw/qRB+6fMHJcBz8HQ==","shasum":"0f52ac28efc0c12169a4edcbf22c7c2101a3b30b","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-4.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFH1zlBSNxtEGelm6IUuckthTgty8WaWgV3pkxTfuSMQAiBPM33GzvazeOlZi17Y0jU9tkTt9ENXxQlfZAoT4l5KaA=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-4.tgz_1507303181183_0.5159773975610733"},"directories":{}},"0.2.2-5":{"name":"mangojuice-core","version":"0.2.2-5","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-5","_npmVersion":"5.4.2","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-5W6L740p0TqxOjsWyekQhe4UyAlJ34bH4uCU0juaHaeLCMWOgsMk3376CuhNZnC6qmgM2yxgvLpnQ4b9TvSoRA==","shasum":"e3eabe552ecbcf35efbd168591ea314b664c6a51","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-5.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDH1eOsquyPoKbQI0d8YGCqKQrjhwSwlXnZ5u1CrCvcjQIhAK9lF7sKHL8TLUGnDNj1PcwAveVBqp9iGvoUtfPaYAYz"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-5.tgz_1507644145517_0.27093251096084714"},"directories":{}},"0.2.2-6":{"name":"mangojuice-core","version":"0.2.2-6","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-6","_npmVersion":"5.4.2","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-RfdmgdbJdUYLh3xfExXGcRp75eaq7MFt2oiDOsSsHXIZugYdETH5twfd58tyqD7TSE9KsbedU58eqpdcW9v8Gg==","shasum":"e6ee83c1f1e7024ca3d2ce4cdcb073dc0d9c3cee","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-6.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDA/9EA988gmHXEfEUVNFf5eI2DACCjmT3tlenml6OYkQIhAOGKu+oSPDz7E1hw8Et0dNnT3txMLy/HuoTDbaRzjvbv"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-6.tgz_1507650336451_0.9051691743079573"},"directories":{}},"0.2.2-7":{"name":"mangojuice-core","version":"0.2.2-7","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-7","_npmVersion":"5.4.2","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-vAUbZGbjdKWxjjV1PT4iulSsW+MJ+EiDOyNsy8uPmWW4pZ60O9wu3iboFB5yA3vTTPFA3a9HfxO0ALvL44pBrw==","shasum":"21a8a0954bd5b5f414211a1196b8483b6c53e3e9","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-7.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCNEhEBCanwpc1jhTsJWaUMce2IbC3p/ed6PTyLG3eXwwIgPG/7HoF4QshyqacjE6GigswyxDUBONgHH8Qsq/iqaYk="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-7.tgz_1507666865625_0.39936678297817707"},"directories":{}},"0.2.2-8":{"name":"mangojuice-core","version":"0.2.2-8","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-8","scripts":{},"_shasum":"48e0b115fd4152f9b5f836fa033882b3126c66d9","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.8.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"shasum":"48e0b115fd4152f9b5f836fa033882b3126c66d9","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-8.tgz","integrity":"sha512-A8snIL7E0NQzV+vftbB/XqA9g6NlHhWsO4AM+uWJ+/IZLANanBJRjusdVZ+D9L56EOPFAA9Cp7RzAYBgG4DylQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCsR4c9SMuRquJXtnmvs5NUHzp/5BWlEp/qFQjmIVydJwIgPMbp1gcV418pUTWqjz1cayk8EJYKn7ag6jJfjlT9T3g="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-8.tgz_1507896925831_0.09645908465608954"},"directories":{}},"0.2.2-9":{"name":"mangojuice-core","version":"0.2.2-9","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-9","_npmVersion":"5.4.2","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-bERcECFxg5ORMvy3sCFQ84Ffuz1XH6BwctlUepVIwv16pvWj3yMuSXcDj9A8F1feNmZliIVYBaUTi1+hVhTcmg==","shasum":"ff27b7a1a2c2681291e21c663badeb5040950138","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-9.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAh3l/WSSJkCPm08wO+8OMMM7DhgrF91pXo5apbbLBfXAiEA+kIGhA3+eLjq5Ar9y8Cbc4aagpq4IqTu7VinhuDkQ7w="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-9.tgz_1508018596735_0.7646734798327088"},"directories":{}},"0.2.2-10":{"name":"mangojuice-core","version":"0.2.2-10","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-10","_npmVersion":"5.4.2","_nodeVersion":"8.1.3","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-zPm0EoYMwEaUH5Mc8A/5kKHtwQu6lXGAPG27qLL8arCEwm2NXKTE+i1XlGt0CXDANUsmMMM14w4+5U5NUU+Liw==","shasum":"579814e62a419fb6604b32aad8e6bd58233b9ba8","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-10.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCCdq/MvS6Az8AEcyQrcu4LyzAvNEQspas+eFzaKUikrgIhAP2DeRUqxZEuNGmwyMx2I1tJLMlGe6WZNy0uvc/FUZqQ"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-10.tgz_1508097147150_0.2566166154574603"},"directories":{}},"0.2.2-11":{"name":"mangojuice-core","version":"0.2.2-11","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-11","_npmVersion":"5.4.2","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-SEGpHAdxAzDW/2j4YMK2B3SoMBBqR32RHqguL1lLCB0q68gsYQrM4zubhLHtAQbf5ZuqroIuj38sBfihLIVy9w==","shasum":"af4badac805e4425fe8aba1e1ff9944cc4e17202","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-11.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAmNjJqdGFWUnEBml7OHUtRMUkX4JrYAT7g0KbEJ7lsQAiEAhzqEr9H1uoPoI10LKXfVXuZu+JYHMtOj+tIFnL16qho="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-11.tgz_1508146630066_0.8734479488339275"},"directories":{}},"0.2.2-12":{"name":"mangojuice-core","version":"0.2.2-12","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-12","_npmVersion":"5.4.2","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-fC1G582s5qeQ8+tDIIAg58HR1jJDvidJcRZNfSSbHfZCj752ijFTJx9o2wLNz+eOzDs7dlasvyrBG6WrrHSP2w==","shasum":"50fe1b01ec77260e6444b6d0a23c1f3c70f88b84","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-12.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDl8wG9IQyL/Gvk/WTmDu/JoaqiJkN2p9oz85B4uVh6lgIgUywMQ7Vhmt/qd+NaVXdK56TPhI5YpKY0Y8QHaIIGWko="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-12.tgz_1508160264039_0.2348266199696809"},"directories":{}},"0.2.2-13":{"name":"mangojuice-core","version":"0.2.2-13","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-13","_npmVersion":"5.4.2","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-brNWGOwbI3BzzSZIhCYS3w83DW/rn4hO6iwfIrwk8w/iv2upZDyVp4eK5/GUN2GMDQBxoKxWK26zGS0wjt5gbA==","shasum":"b70a75f196eb428a2e84797da4c05a7e1902e3bc","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-13.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEPuUm6Sd/9z9sD8FeCtslRMj8J44Er2Zy6r7mlglsIjAiBEpPdqZcTXQFiCRhzleBW+CBtgH7PQygoGe6evIfr0WQ=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-13.tgz_1508236576773_0.9203761990647763"},"directories":{}},"0.2.2-14":{"name":"mangojuice-core","version":"0.2.2-14","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-14","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-N34VHz5RemVWycRctgLdlv33e7Rv1finhDDA3vqsa4jXTR9etVtbn/7d+KJRMXVLcCNVw02vriS8DWis7X1Z5A==","shasum":"9ff2b6d48105451c2bc4a65b0c40dca06cc76ef5","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-14.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAJHwhJMGLJtq5BKfw1TpTWYtzefKMltCNMzU2XGGxYRAiEAntKU4nnPaJ4CNXj7RYltL1Ey65d3VkyG7iXF+piXjAg="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-14.tgz_1508409249248_0.37125529116019607"},"directories":{}},"0.2.2-15":{"name":"mangojuice-core","version":"0.2.2-15","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-15","_npmVersion":"5.4.2","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-MXdnrfQ9BuhvraxqVfnfYXJhnFsyduzsF8fXF7PztZkhDUs2qW6FeZnbApuY3hldZs6fZOPR5gtL/ruxPFxXVw==","shasum":"56b3fbb9e34a93b010a8c016b11fcbbe8035ff47","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-15.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQ/0H+j4QGbSvn/MBFqn0XjXJw5oX4p4bxHD9WcvY7cAIgPiWf32cJqnO0XqeNsCoqO5HY3xI1gnkEh9bCKRfPR24="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-15.tgz_1509483309688_0.27733999979682267"},"directories":{}},"0.2.2-16":{"name":"mangojuice-core","version":"0.2.2-16","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-16","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-T+DbgLiFi3fCOUMNEAuQ3EGpfveCPTM5RvcZFnSzs8YrI3QUUTDJvdpLDqM+m5ElIHaEQ51g1v2NRisAFNGaIQ==","shasum":"78c427ccac86d4b439fd5dafeed96ad177704986","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-16.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGCkNsMVH/V48XWY0uTI33E8enznWQtvJXsQwQUuOziCAiA+F1miDCDagWc6bvOtHx0oKNbbp7obp7x/zXRYhEmAQQ=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-16.tgz_1509875778220_0.26364287710748613"},"directories":{}},"0.2.2-17":{"name":"mangojuice-core","version":"0.2.2-17","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@0.2.2-17","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-FtCHOxAHrWbMIsCpq6zLo3RyQS0c6PuanQGWKV8TlyaCJE0pjRiirjPw0erZ2Bw6U8bAoQzcxkS7m4L5CuS0EQ==","shasum":"7fa9cf648cce549d13d9542e5ccb2ac9a8179130","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-0.2.2-17.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDZQuO0Qunf8sVaJX2y7WY30og3G6sNmuFNQvCJ5M81wAiEAl5kKs65JfwwV+UYuvEHIa3PKiaxzt+TeQnBQImZzqIo="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-0.2.2-17.tgz_1509963957285_0.25293621933087707"},"directories":{}},"1.0.0":{"name":"mangojuice-core","version":"1.0.0","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-VNPhHOC0jESKsbFQj2Yr9VWt76wLtwHx/3Bi75qF3sSfPerHB/vDrbMpwVv25elUYA7MPbKj8/qc5kHuuFoCDQ==","shasum":"7a67335b3d25d1af67c65d0b35e64d4cbe1ee94e","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDTwSDfu4jsPz95gVQoAgE0C4Wdpco5QvLQ7iBQgFIklwIhAIODNFy8qtUDtwoPwEkNtlDqQZ+yGwx8bqbhPWNBCLdb"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.0.tgz_1511440200254_0.12818281562067568"},"directories":{}},"1.0.1":{"name":"mangojuice-core","version":"1.0.1","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-ZXi4qH6AEnVtuqp0/vEfAKq7fDbSfIA9fCA/trx6fI8sFPsdRvc6CsZLz7RVzPjuBhXebZlLRRXoQ/Tyy7yQhA==","shasum":"389ae5fbfa488237343968359290de243888def2","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDDaJbJtZXJetnrKkcD+nFMYNqPycNz2ZUf/1eHkjnefAiB6yE6V8kFmhNTQeFs4z3sGhT7gI9zlTsBw3hFJ5R5dnA=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.1.tgz_1511441648845_0.23009286867454648"},"directories":{}},"1.0.2-0":{"name":"mangojuice-core","version":"1.0.2-0","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-gO0WaGGKhz42s40HTS/n6/+Z01rxLBymtu9jpV88rBg6jqhB+Bm165b8R3B0D/0oTQdHUBlyvMmXsuQ34katug==","shasum":"9664e2461db03072b25d0a50681d192590f70574","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmq43FUQAAQnKzt8FAKCsROSpFx/2nXakWSIZe4DFc+QIhAL/P21+A705YEPb+PdR5EHTAonnuzup2DAbs95ocvQHG"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-0.tgz_1512116232799_0.8426748893689364"},"directories":{}},"1.0.2-1":{"name":"mangojuice-core","version":"1.0.2-1","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-1","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-R7x4LuTTegchXQxQj7UAj9Cld/bpgYinpE6M3ZCc9zKL8h7FUepKmlDDRNtJBdJbWbpea6P5hv/ysAByJb23iQ==","shasum":"794247d11e6ba3b4782d38b4d48a6e3b8450e7d4","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjWyRHk6EL3G4Ff7wPOWA9R7fwrNHNN0p6e8ZKOl3eGwIgLDZXZFxVohCvN/87PPBlR0B8I/pWPEDAiCffUtQqbO4="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-1.tgz_1512125878002_0.11056315177120268"},"directories":{}},"1.0.2-2":{"name":"mangojuice-core","version":"1.0.2-2","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-2","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-WzSSkmdkK5icDsKfcAzz7IQCBdx4K3Y02cCZpX/u7CnzQfpJGL9Jtj5pJPubqQb5kQ2EW5DTUWmUnjMJXYHfIg==","shasum":"4784cc928eb6a3e10b8a49a89d2681eb8e37ebac","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDdBRmjMi3lUfEvUsZ3JVmK1TiCXjYSXbbVsjj9RDYkQwIhAOw7phtftIhBSV3+7fbOUGkB2AQVfsXV3wt9Y7mWrB44"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-2.tgz_1512128457999_0.9211141541600227"},"directories":{}},"1.0.2-3":{"name":"mangojuice-core","version":"1.0.2-3","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-3","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-sE7xKzUmH8IhXkCeRMH66u+2gG/nTQQ+IJwqik2kVBYhHe2yZQIaSRKBPU1TrvoLlKlAbDERodvi70T4CPSrgw==","shasum":"9bf3be8cce746c48b9bc1a5eb835218b1ace2d05","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCIOxhEtouq1LQQANrKb82Wjyy/qIm/IWXmjS0Y5Vu0iQIhAONZJh/9l4Ju5nhtXP4H9w0AV8Gj6GkhqLgnQoSwlHVM"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-3.tgz_1512132501795_0.932025906862691"},"directories":{}},"1.0.2-4":{"name":"mangojuice-core","version":"1.0.2-4","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-4","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-dB22+jTFpMwanMGNnprZbm/7tMmT3F+FA27JD5ibKocGYgbR6i+jCj5IDB+ilQNWjamT/bRH6IQS3jg0/KvU2Q==","shasum":"f7a2fe019b1b791ddf478dac7e0c934681353373","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-4.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBu8gY5zxgH7d1Jf/TAasuiKayRBOY7eFa3qGNr5ErKrAiBoL6ZJnrujO3mAHfna+NMH9KV9c8ya7rAC+0499zcP3g=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-4.tgz_1512479653859_0.6849140576086938"},"directories":{}},"1.0.2-y.0":{"name":"mangojuice-core","version":"1.0.2-y.0","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-y.0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-CEp02Ejlk+CpPnnE0Skzjy/GmeUkTpoDm+skIvyRaJfMNWkrbvzGQNVnRyRyVijs2jCXkcSeqcsfC8nUznpEBA==","shasum":"4ad71143d87232fb2b2e6892c849ab1471cac71d","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-y.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHw3n+PrFsLzSnYpG1cgDINW9Zse9SFBUjXCct8itaawAiEAoMFONZL5U3hNKvBLmoRGXQmigpsvYN5ae4qK1fyiX6Y="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-y.0.tgz_1512504182672_0.26949408696964383"},"directories":{}},"1.0.2-5":{"name":"mangojuice-core","version":"1.0.2-5","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-5","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-l/vu2majUzqbXcl3zK3oCm4SNZ1DoO1wekZrEMz1B2mzKMp67K/x/ho7rmN19DJRxauVwwP+qRVTvR/zHwARww==","shasum":"e4568cd6044dfaef887477f2003136e7593cd0f7","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-5.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB05ECrCn1DXhuUzpn0vkLU5Ga+kpqJdSvLSsUATyAgIAiBoInONDpKhK/VcRmvprUdp5FRtbStdxey5+AESZTN8pA=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-5.tgz_1512504472069_0.49737793137319386"},"directories":{}},"1.0.2-6":{"name":"mangojuice-core","version":"1.0.2-6","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-6","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-Bw/rxuaXQuNiJVY9IAoCtqcZjF5ttbz5JIjUl4OZrt7G1TsV6uRDuammklBMrstltliQmh2qAU4t+dq8E44/XQ==","shasum":"04b739bf605018d7dd39c8d9c86663f87973726f","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-6.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD+8M+tZ7Am4KWhvu9H6cZRAwKvJV3T9VpoN+HdPBZk1QIgAUuyIFSy0S80kTZau2TUydJ6f1QnvTIFpjTe7OQNNKo="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-6.tgz_1512507011249_0.4397756401449442"},"directories":{}},"1.0.2-7":{"name":"mangojuice-core","version":"1.0.2-7","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-7","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-9r/JtbiqVagrew1Fw4QFIDMCS1g6FFYQNljvcRdTKgeJt8CyR0Po/ovpKu/UMAg3HtkTlKvQhMN5mKGOBKxPBw==","shasum":"9ac06ce40dd0d4febe5226a3a59dbfbf255b55b4","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-7.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDBL/j0Opf7VPZ+JJzVrYjFSpLO7r/TQ+2qYRYeN9dpQQIgT/W+asyhDeWBiml1z8OKa6ztLs9dqo3gP+8vLFcTFtQ="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-7.tgz_1512582512787_0.0838354064617306"},"directories":{}},"1.0.2-8":{"name":"mangojuice-core","version":"1.0.2-8","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-8","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-x4SI9bLOsn+AZTZABH0tn3Yq/bEIEQoma1+yxtZNaSXDaTwnMZEnKv90vQsS1onbCQxTGZ79kJ3qm6W7CgY8Iw==","shasum":"b552846e85316deafbdb532d12700a02df344702","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-8.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBdmoA+eD7HdDz4VWGqbPucuK2GGggue48Rk+OUfVrt8AiEAwUjiXJ5Gam62FvVxgooUJdou4wckZ2le9p5u7CBKCb8="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-8.tgz_1512585601496_0.39006297290325165"},"directories":{}},"1.0.2-9":{"name":"mangojuice-core","version":"1.0.2-9","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-9","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-31FBEhN/xXqGHgnIbPlV4fp39xQf92HMDwtRnxvYomJOKXMNqGwI4IEvYZEqIpSgvMFflPhXYXAUPJvyPtPP7w==","shasum":"c82e37a94ffbdac1177d23a674771c91b3abb8b9","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-9.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDFSPVGipDxihgIzBhb+yjfL40rIFoH9vfnal/j18OtnAIgS2UbDjF28ezEk3qY3zhTuG5I6pea3UlH68DYC4J0uxc="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-9.tgz_1512585987958_0.5360569912008941"},"directories":{}},"1.0.2-10":{"name":"mangojuice-core","version":"1.0.2-10","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-10","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-vycKDiKcMzrU8jPBUk7tXFHekDXGNGLoDmFaoD6m1rpQcGpjJJwtEahEOF5RGysTgKxxFNRziW3vvx+foBC2uA==","shasum":"bf8bfffb5fc63efe5504cdd5b08f6edd4ea12e52","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-10.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEbClIvpsWbccJP7iUdewHVnoQAbExY2KLTG/hBVfFpuAiATSO3/9i+06A/D8AJBnk/9vAVrkUcIy5euy9X2Z2FiMQ=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-10.tgz_1512635357074_0.10329146473668516"},"directories":{}},"1.0.2-11":{"name":"mangojuice-core","version":"1.0.2-11","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-11","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-MJswqgBwp5R3smaH0cTIxzMzZPhcCYvzGqYLhq1PsNTBQtcfqzCScwJHsxiOROGB5sbIG59s3wOqL8gzBLkuPg==","shasum":"4e2f782051c0598051ecc4539d5db017e15ba0e0","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-11.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD+zoTQKTNv4LZd7Dk9EAVYcucQFZO1BC97Y5m9wO0/WwIgeZuh+JAJd1Uvs1qXtdzttwQULsg+Lf8YNxbELgziUGs="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-11.tgz_1512639351317_0.02013712446205318"},"directories":{}},"1.0.2-12":{"name":"mangojuice-core","version":"1.0.2-12","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-12","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-B6fGCOOarOU84tO0f0IUU2ZZ3LOaTuIBAqVC6si3y2SXngBKbGdYCC13uusd+0BMoE2SmEcxoJBo4162aG/ZnA==","shasum":"0c53ed0a0ff1feb697fc155a44b2f3f70ace53fe","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-12.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDfcvQECtB4RRLpJwSLkKpt7+R4pgzepK0IS2hleaP0KAiEAnmpOI9TDcQFRLYUipjYypJLDubXCdnacUOsABmhTJTw="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-12.tgz_1512769618279_0.09816570114344358"},"directories":{}},"1.0.2-13":{"name":"mangojuice-core","version":"1.0.2-13","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-13","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-mnOFjBAVY3z2JYwSVd3AydRTMT3jSFf6iAFo7XOtPuIuQSlM6w6U/9xuRaSxfOOb1eFqKCP32HnkcYDEeU5pjw==","shasum":"5708803a76bfe76d141996f15f2cdb5806986dd2","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-13.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCHw9F5GO1MjvU43P1g6e1Bn+hwemmJY/9YTK7CWynBP0CIHEmac44v5TkXGQKfQfRckMiZkhLjyozoat7qTr07tZu"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-13.tgz_1513081714455_0.10530338203534484"},"directories":{}},"1.0.2-14":{"name":"mangojuice-core","version":"1.0.2-14","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-14","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-0YNsPTXcPTJIQKfG+mH54Ar8X5sATZPyOHPNONPA6t1ps2VlRQoHcgtZBqyiCpio3YyH6IqMxcu5O1p/CO2t4A==","shasum":"c5ac85f0b06e114c1f90cbb9dc7c750987783b93","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-14.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDI2TNR5RzR/pMbls4eo8gB5XXYohAD/IK5DKje+bNAiQIgJfIuBJnvHljhDFNu+0USP8USPI9/aKQoLRbK4owIgts="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-14.tgz_1513169197197_0.8262955527752638"},"directories":{}},"1.0.2-15":{"name":"mangojuice-core","version":"1.0.2-15","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-15","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-uh/vrn0lcBQMzgy+wj1UBHpbmvgRMJK5uIF+wQQzJIgKKgI6E5ksr/m4KOfQYKu481FbPewFdIMNnaP7bjU4xA==","shasum":"599134ab8926a52f9cd3ca8fc9c17b3cff25d165","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-15.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICM5MfMPMSyJjuyVM6H4dnVPHdjT1rGLHtofSHzka2+9AiEA9d8mRx00HFo9348CVimQibl43T5NMPUsQ50Krw+JspI="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-15.tgz_1513242748198_0.2856538046617061"},"directories":{}},"1.0.2-16":{"name":"mangojuice-core","version":"1.0.2-16","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-16","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-UBeSW5RmB7iap03vbjTee2Dr+fpCqeDPcP8P7wdrtPTG0QJvuS+x5SnBfMiiZqBUHOSJ5CZW4J0u7M10Ymtbcg==","shasum":"1114316b024d4ceac0b3f47365d03b6c2f9acc1e","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-16.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC3oKdsb4DCsjSESDFIorIYd2iMmmD3YIlpJis+xbIzZQIhAN8ZGZCLVJsm6amQyJZE98IuYHkDLrwnBNLUF7M5JDND"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-16.tgz_1513244872906_0.37864307407289743"},"directories":{}},"1.0.2-17":{"name":"mangojuice-core","version":"1.0.2-17","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-17","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-ZCrxF5z8jxKGd2tAlMeYlLGtUTolhdWz/UiNxs6HCcUyq/JwK2plbQrHbzVRfJ+BDh+AOTz58WAy6V+Zw3FvKg==","shasum":"c411ca21199f745026ada04d49deca47d3f570d4","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-17.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID5reVHFHjwNbrOG5afHtvH6tEY8fO2ilBLkbo6Kmu4vAiEAzdYK9HkjS4pZEOt8TsAQekuchWdHrBOwHZgi+TUhk4k="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-17.tgz_1513373025162_0.25530325644649565"},"directories":{}},"1.0.2-18":{"name":"mangojuice-core","version":"1.0.2-18","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-18","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-mw1uq4ahQxnk0ByngGemhsQIppKmj0MnNK1itpZ2YdwKuJPSK6Kx4qndAZtyXUycsbxM06jFOlunezpBLCFsAA==","shasum":"4185596f58569e8e796f65599660940d9bd0389f","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-18.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEuShk4ewI4zDwQIvlyiKsKJ5MMBlv0jHB3lsA4f7B4GAiEA5KAk4EM9CAvMxiwq7HW2YdLEwrBeA9LDw7BZZCTjL2U="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-18.tgz_1513535769805_0.6258445277344435"},"directories":{}},"1.0.2-19":{"name":"mangojuice-core","version":"1.0.2-19","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.0.2-19","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-MLv6/BBig64XDHqX3Ugs8/8XkzhKm3O58NhOoa0l/YcI9Sn6D2S7JOpTHAbqPLbuYkUHallHTfbnovtnPdnV+Q==","shasum":"090c76c8ee68f87707c078518a786a8b836320ae","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.0.2-19.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAX0g/TBASUC/DLV3q4x61qdIPmVCiBvid2zKlfK3uLVAiBKwTrtMNoY4pdvIwTA/lPQFh3j2Mi5KFQR5iqcIveS1A=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.0.2-19.tgz_1513537004779_0.8847338289488107"},"directories":{}},"1.1.0":{"name":"mangojuice-core","version":"1.1.0","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-2oxm/cGLKj5Mwr/GjgHwSmkLrg81rT7XCnXjyFJgSeQ10+P2lgNf7wWKxGuDs0+WBQf/s8o4etQxOwdUrTNh5w==","shasum":"4d16dfa4b2556032be2f222274648a8f53458377","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDVl3u7LCMbzlNo8XGH8quVduhPf9fiF8IY0Zr5WVQWLQIhAPX5g3lABkSl55tRuIJ43NwaDJc7G0B6MO86HRMDZu2R"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.1.0.tgz_1513718020138_0.9643574496731162"},"directories":{}},"1.2.0":{"name":"mangojuice-core","version":"1.2.0","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-SDX3H9/Xj+vkCthDZQ3InLxAq+RYXHIB9eW61RhdXg84RJz6/RIAqxGVGsq3QVrIv/e+azwLKqAjAZPikLoRWw==","shasum":"23f43a8c532b96127bcd840db75e7c82d1d1449d","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIENMFf/uRSsjBT0eYLug41E6Mz5EnBEjfEpj6MlSMWm3AiBmb8+fsFVLSdaBurydU06ka62+MhUDQrrhDV+ngqabcQ=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.0.tgz_1514020661151_0.7764511012937874"},"directories":{}},"1.2.1":{"name":"mangojuice-core","version":"1.2.1","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.1","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-qUN3FB+IhjON2szEHerWiOKb2jXQidb+v7Nzo+f3Ttfft2YTrggdmUdIc3HN/GA0z1Sr5YacpSYqUGgK6jVJMg==","shasum":"cb787440455783157fd3c01c3e06ec468a40aa25","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDgiPae+wXKR9NGWUQoE4XL4pUopANPCJj+4aReB3u/AAiAnk8lWWxfeXDrM00ZU7bJYb0YzIeHz28FyHC/mm6y/tA=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.1.tgz_1514451380298_0.4672497403807938"},"directories":{}},"1.2.2":{"name":"mangojuice-core","version":"1.2.2","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.2","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-1IXgNo/ij1qbN6iNFYU7OHcqVVMMKUfemdzmG4hBcEDzCC+1HJwqTAmzOI4o7LMDfjrR7zwe8HCSTzWWbGaNVg==","shasum":"c97f2703425b1839076734e0af27b0fa49724820","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHy9r9eZYo0NpR35Fd86YpBIZ5OKr//muLiD73I2n3FSAiEAhNYhLHaKBVz0awjb6xH7Jah/07I9CZY/DuxB3MI5JuI="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.2.tgz_1514661943350_0.2599014863371849"},"directories":{}},"1.2.3":{"name":"mangojuice-core","version":"1.2.3","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.3","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-4AeeDUTEjXSXzCGBxB8jOtLgTNCWKJo+lOg5LNOHieFYdBhrlDgUMqLsVsmN7tmRnXYu4Gk+ZVcrSHN7tX432Q==","shasum":"6459abb25766e6e738b0b8bb2774d2dd38ca3cd7","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFAS3hjj3rIQyODieBJNuWqjE/sJC8crqJe8WFTCveQhAiAOEvDK/JCifYu6Lgr5w4UqubPEHu0miC3yoeILvzgbCw=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.3.tgz_1514819620245_0.880235108314082"},"directories":{}},"1.2.4":{"name":"mangojuice-core","version":"1.2.4","description":"","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.4","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-gG1abRI9y7ZU4zOSxMF75Np65srYayeH9vsUREKxYoUPdVHhsYhgNQmWfS80GyIf3NsN8TAe/0j5dOmVgoGInQ==","shasum":"94423a84a541d8462aded045a62d7ba50a542f83","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.4.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDQ80enleRWArI/ucrYT1mEGITy3/xtvYhSd+7HXiZzPQIhANeqQh7fPwKs9/Mq+odE5/eZXnxt7IWePPSQlCfYDT+f"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.4.tgz_1514921552750_0.4450512989424169"},"directories":{}},"1.2.5":{"name":"mangojuice-core","version":"1.2.5","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.5","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-azl4w0UiEaqQ30XPq4F3bZaCfo4NeDuXmM6q/zmVMFoo7/qU9ugdegy5eqD37OE63MgCx08/EAWXfhYM29tvdQ==","shasum":"200483f276771f1155cbc063b560c34d40566406","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.5.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCsyVxMDHYnR8qzWQ2ajZ/jQwbidgF/LywfNz4JkxcUtAIhALyFsb2UwlxVWjm87LRBJCsH0ki/2WkGXQn6ObgWEAjm"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.5.tgz_1515314008838_0.6070527762640268"},"directories":{}},"1.2.6":{"name":"mangojuice-core","version":"1.2.6","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.6","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-Axw/dpp5ly1v4faJKNcEzPkWWAbv2TLQsPfaWoyZU1IjV8kQ0EfDjYknoRGdK0OSWSgVWJs0p0C58mahPcyLPA==","shasum":"587868897d473ca8b08c8e1dcb1b4703dd5ece02","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.6.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEzXVFlbJQhEntF2AImHzAiCQCun1sHvW2iPxOnUmepOAiBjof7X50CP6yvCRmTWZs2LLH4hAuKruV9FnFr6tdrKCg=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.6.tgz_1515314541555_0.7974355614278466"},"directories":{}},"1.2.7":{"name":"mangojuice-core","version":"1.2.7","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.7","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-A4WFqGpsdckQTxUEAgME1GWjWxYigk8BeBNTRwf1zIEwY3BC2pCAda+orEx2jl5tDFvMccsiEjrbqSHP8NqOQA==","shasum":"123935d97a6d00408f55fcf9b0161a3b3de3054d","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.7.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBR7FH9bMtzfuY/AM2a+aFa1ESezb/eQB+DST4fmIKdfAiEAhr1OwV8gig2bOmuIBiOn53HJIR9DD6WpVKB8RE6MPlk="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.7.tgz_1515491627471_0.36341949948109686"},"directories":{}},"1.2.8":{"name":"mangojuice-core","version":"1.2.8","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.8","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-sVFvOH0iJpqB7/HakV5Um0Fq4cKxStdB/bLc8i2MRGpg6cfF3oD5pvfZWr5DAL34vOeWgKB/ORRvQg8+6Y0NuA==","shasum":"fdd9813512e888efe86dfe60169f6c26c5b491c0","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.8.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5vbP11w7wwT1NnucUY+icPtyzK3kwRBaRE9euetvBewIhALA3dOSuetfB/0FaeqVfjO39jaypez7If1dEbbw/N94j"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.8.tgz_1516359800154_0.5554127404466271"},"directories":{}},"1.2.9":{"name":"mangojuice-core","version":"1.2.9","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.9","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-kzL3kfUIUg/VL8C9u7w6DPMU0G55rMZKvfUuq24A/DUADHnvJ/AYRyQOudv9z6GmJhXn8vrJVyTMWwa2mt9QlA==","shasum":"e1eabcd44f19968e8638f402e2f1e78bb80ab551","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.9.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFOVenqfbRcZ1BO7CBvPSp0jg2NG7FmLN/lyg+FpSoxTAiEAi1uLDevfwHNfG2iektE1X5vbo/9FVtRbmL10NzNFhz0="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.9.tgz_1516623740267_0.9628878317307681"},"directories":{}},"1.2.10":{"name":"mangojuice-core","version":"1.2.10","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.10","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-Ryzvp4WRj4HGiUAGmOAHuYMMC6Vd6B50Q3IHuKxu04qrkGCWLFApbcUYmpL4l54TmlHpGtQVe1ihEw1pzHcChg==","shasum":"5d3defb4011e3dd1c8fc0bd0ecf6abb36c16b8de","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.10.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIQCgaKm2rSeAa/zweBiHsVIAH3S0eQxz4iO7CzGVyW1xJwIfFBr257MFZyajs2IioHX1stw9M/pfa7E0LIyGg76Gow=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.10.tgz_1517415043591_0.23265569121576846"},"directories":{}},"1.2.11":{"name":"mangojuice-core","version":"1.2.11","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"_id":"mangojuice-core@1.2.11","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-2o2nD2IaxAhw82RtkQ73HIexAvLkivzpRkVmHs/1JY3fbzq6AWhSYRhc4UUmrRaQeCYBWl9VDIRHkyt21bB71g==","shasum":"d1051499c12ddaf0d5396ba1f08fa257b2c9ef89","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-1.2.11.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGPrgVoilJl45jEjKgu35wtB6A/hElimJTwQG/etMQA2AiAe22bx838eyLGE2UZ2oCu4ZxuA0r9d6c/4AVnrr3inoQ=="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core-1.2.11.tgz_1517591456621_0.6318864882923663"},"directories":{}},"2.0.0-0":{"name":"mangojuice-core","version":"2.0.0-0","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"readme":"# MangoJuice Core\n\n## Reference\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n#### Table of Contents\n\n-   [Basic](#basic)\n    -   [Block](#block)\n    -   [LogicBase](#logicbase)\n        -   [config](#config)\n        -   [children](#children)\n        -   [computed](#computed)\n        -   [port](#port)\n        -   [hubAfter](#hubafter)\n        -   [hubBefore](#hubbefore)\n    -   [cmd](#cmd)\n    -   [run](#run)\n    -   [mount](#mount)\n    -   [task](#task)\n    -   [cancel](#cancel)\n    -   [child](#child)\n    -   [depends](#depends)\n-   [Extras](#extras)\n    -   [Process](#process)\n        -   [bind](#bind)\n        -   [run](#run-1)\n        -   [destroy](#destroy)\n        -   [exec](#exec)\n        -   [finished](#finished)\n    -   [Command](#command)\n        -   [exec](#exec-1)\n        -   [clone](#clone)\n        -   [is](#is)\n        -   [appendArgs](#appendargs)\n        -   [bind](#bind-1)\n    -   [TaskMeta](#taskmeta)\n        -   [notify](#notify)\n        -   [success](#success)\n        -   [fail](#fail)\n        -   [multithread](#multithread)\n        -   [engine](#engine)\n        -   [args](#args)\n    -   [DefaultLogger](#defaultlogger)\n        -   [onStartExec](#onstartexec)\n        -   [onStartHandling](#onstarthandling)\n        -   [onEndHandling](#onendhandling)\n        -   [onExecuted](#onexecuted)\n        -   [onEndExec](#onendexec)\n        -   [onCatchError](#oncatcherror)\n    -   [ComputedField](#computedfield)\n        -   [compute](#compute)\n    -   [Mounter](#mounter)\n    -   [defineCommand](#definecommand)\n    -   [ensureCommand](#ensurecommand)\n    -   [decorateLogic](#decoratelogic)\n    -   [handleBefore](#handlebefore)\n    -   [handleAfter](#handleafter)\n    -   [handle](#handle)\n    -   [logicOf](#logicof)\n    -   [observe](#observe)\n    -   [procOf](#procof)\n    -   [bind](#bind-2)\n    -   [hydrate](#hydrate)\n    -   [delay](#delay)\n\n### Basic\n\nThe most common APIs that you will work with most of the time\n\n\n#### Block\n\nBlock is a top level component in MangoJuice which consists of three parts:\n\n-   Model factory function `createModel` which should return a plain object.\n    The main requirement for this function is that it should be able to return\n    some model with zero arguments. But it can also accept some arguments\n    as well.\n-   A logic class which implements [LogicBase](#logicbase) interface\n-   A View function which is aimed to render the model created by `createModel`\n\nThe View part is optional and it could have different type depending on\nselected View library to render a model and particular binding library.\n\n**Properties**\n\n-   `Logic` **[LogicBase](#logicbase)** A logic class that should be attached to the model.\n-   `createModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuld return a plain object which\n                                      will be an init model of the block.\n-   `View` **any?** Something that some particular view library can render\n\n**Examples**\n\n```javascript\n// You can define block in short way using an object\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nrun(MyBlock);\n```\n\n```javascript\n// Or you can split it with modules (recommended)\n// ./MyBlock/index.js\nimport Logic from './Logic';\nimport View from './View';\nimport { createModel } from './Model';\nexport default { View, Logic, createModel };\nexport { View, Logic, createModel };\nexport type { Model } from './Model';\n\n// ./MyBlock/Logic.js\nimport type { Model } from './Model';\nimport { LogicBase, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  \\@cmd SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n}\n\n// ./MyBlock/Model.js\nexport type Model = { field: number };\nexport const createModel = () => ({\n  field: 1\n});\n\n// ./MyBlock/View.js\nconst MyBlockView = ({ model }) => (\n  <div>{model.field}</div>\n);\nexport default MyBlockView;\n\n// ./index.js\nimport MyBlock from './MyBlock';\nimport { run } from 'mangojuice-core';\n\nrun(MyBlock);\n```\n\n#### LogicBase\n\nBasic class for every logic. It is not necessaty to inherit an actual logic\nclass from it, but for better type-checking it could be really usefull.\n\nLogic class defines:\n\n-   A set of commands that could change an associated model – methods decorated with [cmd](#cmd)\n-   What fields of the model should be associated with which logic class\n    (children blocks) – [LogicBase#children](#logicbasechildren) method\n-   A set of computed model fields – [LogicBase#computed](#logicbasecomputed) method\n-   A set of rules to handle commands from children logic – [LogicBase#hubAfter](#logicbasehubafter)\n    and [LogicBase#hubBefore](#logicbasehubbefore) methods\n-   A logic to handle external events – [LogicBase#port](#logicbaseport) method.\n\nThe logic class defines all the business-logic of some part of your application.\nThe main goal of the logic – change associated model. Check [cmd](#cmd) and [Process#exec](#processexec)\nto have a better understanding how command can be defined and how it is executed.\n\n**Properties**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object which is associated with the\n                               logic class in parent logic.\n-   `meta` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object defined in [LogicBase#config](#logicbaseconfig) method for storing\n                               some internal logic state.\n-   `shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object with some shared state, defined while\n                               run process of the app.\n\n**Examples**\n\n```javascript\n// ./blocks/MyBlock/Logic.js\n// @flow\nimport type { Model } from './Model';\nimport ChildBlock from '../ChildBlock';\nimport { Command, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  children() {\n    return { child: ChildBlock.Logic };\n  }\n  hubAfter(cmd: Command) {\n    if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n      return this.TestCommand(123);\n    }\n  }\n  \\@cmd TestCommand(arg) {\n    return { field: arg + this.model.field };\n  }\n}\n```\n\n##### config\n\nA function that defines init commands and meta object of the\nlogic. Can accept any type and number of arguments. Config\nwill take arguments passed to [child](#child) function (for example\n`child(MyLogic, 1, 2, 3)` defines that the `config` method of\n`MyLogic` will be invoked like `config(1, 2, 3)`)\n\nCould return an object with the fields:\n\n-   `initCommands` which could be an array or a single Command,\n    that will be executed every time when the logic instance created\n    and associated with some model (when [Process#run](#processrun) invoked)\n-   `meta` which could be an object with some internal state of\n    the logic\n\n**Examples**\n\n```javascript\nconfig(props) {\n  return {\n    initCommands: [ this.StartThis, this.SendThat(123) ],\n    meta: { something: props.amount }\n  };\n}\n```\n\n##### children\n\nThis function defines what logic class should be associated\nwith which model field. Should return an object where a key is\na model field name, and a value is a logic class or an object\nthat defines logic with arguments (return from [child](#child) function)\n\n**Examples**\n\n```javascript\nchildren() {\n  return {\n    searchForm: child(SearchForm.Logic, { timeout: 100 }),\n    searchResults: SearchResults.Logic\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n##### computed\n\nShould return an object which defines computed fields of the model.\nA key of the object is a model field, and value is a function or\ncomputed function definition object (return from [depends](#depends) function).\n\nComputed field is lazy, which means that it is computed on the first use\nof the field and the computation result cached until the next update\nof the model.\n\nIf you want to define a computed field which ueses in computation not\nonly fields from the own model, but maybe some values from child model,\nor from shared model, then you will need to use [depends](#depends) function to\ndefine what models used while computation to observe changes of these\nmodels to trigger an update event of the own model (to update views).\n\n**Examples**\n\n```javascript\ncomputed() {\n  return {\n    simple: () => this.model.a + this.model.b,\n    withDeps: depends(this.model.child, this.shared).compute(() => {\n      return this.model.child.a + this.shared.b + this.model.c;\n    })\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n##### port\n\nA function to handle global event, such as browser-level events,\nwebsocket, intervals. The main porpouse of the `port` is to subscribe\nto some global events, execute appropriate commands from the logic\non the events and remove the handlers when the logic was destroyed.\n\n**Parameters**\n\n-   `exec` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** It is a function that execute a passed command\n-   `destroyed` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that will be resolved when the logic destroyed\n\n**Examples**\n\n```javascript\nport(exec, destroyed) {\n  const timer = setInterval(() => {\n    exec(this.SecondPassed);\n  }, 1000);\n  destroyed.then(() => clearInterval(timer));\n}\n```\n\n##### hubAfter\n\nHub for all commands executed in the children blocks. The only\narguments is a command object that was executed.\nCould return a Command or an array of Commands that should\nbe executed next.\nMost of the time this function will look like a `switch`,\nbut maybe with some additional rules for the cases. Take a look\nto [Command#is](#commandis) function to have a better understanding how you\ncan determine that the command is exactly what you are waiting for.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was executed in some child logic\n                           or in any child of the child and so on down to\n                           the leaf of the tree.\n\n**Examples**\n\n```javascript\nhubAfter(cmd) {\n  if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n    return this.HandlerCommand(123);\n  }\n  if (cmd.is('AnotherChild.SomeAnothercommand')) {\n    return [ this.HandlerCommand(321), this.AnotherHandler ];\n  }\n}\n```\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)** \n\n##### hubBefore\n\nSame as [LogicBase#hubAfter](#logicbasehubafter), but catch commands before\nit will be actually executed, so you can compare prev and next\nmodel state for example.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)** \n\n#### cmd\n\nDecorator that converts a logic method to a command factory.\nThe result function (command factory function) is a function\nthat return a [Command](#command) instnace with the decorated function\nand arguments that you will pass to a command factory function.\n\nYou can use this decorator without arguments or with an options\nargument (object)\n\nCheck [Process#exec](#processexec) to see what the origin function\ncould return to do something. If in short, it can return:\nnothing, command (or factory or array of commands), task,\nmodel update object.\n\n**Parameters**\n\n-   `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** If only this argument passed then it will be considered\n                                   as options object which can customize command behaviour.\n    -   `obj.debounce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be debounced by given amount of\n                                       milliseconds\n    -   `obj.throttle` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be throttled by given amount of\n                                       milliseconds\n    -   `obj.noInitCall` **bool** If true then debounced/throttled execution\n                                       won't start with init command call. By default\n                                       debounced/throttled command will be instantly\n                                       exected and only then wait for a chance to execute\n                                       again. With `noInitCall=true` there is no instant init\n                                       command call.\n    -   `obj.internal` **bool** Make the command invisible for parent [LogicBase#hubBefore](#logicbasehubbefore)\n                                       and [LogicBase#hubAfter](#logicbasehubafter). Use it for commands that shouldn't\n                                       be handled by hubs to increse performance.\n    -   `obj.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** By default name of the command taken from origin function. With this\n                                       option you can override the name with any other value.\n-   `methodName`  \n-   `descr`  \n\n**Examples**\n\n```javascript\nclass RegularLogic {\n  \\@cmd RegularCommand() {\n    // do something\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ debounce: 300 })\n  DebouncedCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 600ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300 })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300, noInitCall: true })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 1 time in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ internal: true })\n  _InternalCommand() {\n    // this command can't be caught in `hubBefore` or `hubAfter`\n    // in parent logics. Use it carefully.\n  }\n}\n```\n\nReturns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory function (if all three arguemnts passed)\n                               or a decorator function with binded options object\n                               (that you pass as a first argument)\n\n#### run\n\nRun given block. It is a short-hand function for running [bind](#bind)\nand then running a Process by [Process#run](#processrun).\nAlso it returns an additional `finished` Promise which is resolved\nwhen all async tasks finished and all handler commands executed.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A block that you wan to run\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Same options as in [bind](#bind) (optional, default `{}`)\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block), finished: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)}** An object\n                 which is almost the same as returned from [bind](#bind), but with\n                 additional `finished` field, which is a Promise that will be resolved\n                 when all blocks will execute all commands and all async tasks will be\n                 finished.\n\n#### mount\n\nMount running block. As third and next arguments you can pass other running\nblocks which will be stopped with the main running block (useful for HMR).\n\n**Parameters**\n\n-   `mounter` **[Mounter](#mounter)** An implementation of [Mounter](#mounter) interface\n-   `runRes` **{proc: [Process](#process), block: [Block](#block), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}** An object that returned\n                     from [run](#run) function.\n-   `otherBlocks` **...any** \n\n**Examples**\n\n```javascript\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nmount(new ReactMounter(), run(MyBlock));\n```\n\nReturns **{view: any, stop: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)}** An object with the result form [Mounter#mount](Mounter#mount)\n                 function (in `view` field) and stop function which destroy the process and\n                 unmount a view using [Mounter#unmount](Mounter#unmount)\n\n#### task\n\nCreates a [TaskMeta](#taskmeta) object that could be returned from\nasync task command. It describes the task that should be executed.\n\nFor more information what the **Task** is and how it should be implemented\ntake a look to [TaskMeta](#taskmeta).\n\n**Parameters**\n\n-   `taskFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that could return a Promise\n\n**Properties**\n\n-   `CANCEL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A symbol that you can use to make a promise \"cancellable\"\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n#### cancel\n\nThis function should be used to cancel async [task](#task) execution.\nAlso it can cancel the debounced/throttled command.\n\n-   In case with task, if task was executing while you call a cancel command,\n    the task will be cancelled (execution stopped). Otherwise nothing will happen.\n-   In case with debounced/throttled command, if the command scheduled to be executed\n    then the schedule timer will be cleared and the command won't be executed.\n    If the command is not scheduled then nothing happens.\n\nTo use it just pass a command or command factory as a first argument\nand return it from some other command.\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Command or command factory that you wan to cancel. Could\n                                    be a command that returns [task](#task) or debounced/throttled\n                                    command\n\n**Examples**\n\n```javascript\nclass SomeLogic {\n  \\@cmd CancelSomethingCommand() {\n    return [\n      cancel(this.TaskCommand),\n      cancel(this.DebounceCommand)\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask);\n  }\n  \\@cmd({ debounce: 300 })\n  DebounceCommand() {\n    // do something\n  }\n}\n```\n\nReturns **[Command](#command)** Returns a new command that will cancel the execution of the command\n                  passed as an argument.\n\n#### child\n\nCreates an object which describes child logic which will be attached\nto some model field. Should be used in [LogicBase#children](#logicbasechildren) to\ndefine a logic that should be instantiated with some arguments passed\nto [LogicBase#config](#logicbaseconfig).\n\n**Parameters**\n\n-   `logicClass` **[LogicBase](#logicbase)** Class that imlements [LogicBase](#logicbase) interface\n-   `args` **...any** \n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  config(amount) {\n    return { meta: { amount } };\n  }\n}\nclass RootLogic {\n  children() {\n    return {\n      modelField: child(ChildLogic, 10)\n      // `config` of `ChildLogic` will be invoked with\n      // `10` as a first argument\n    }\n  }\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object that contains a logic class and an arguments array that\n                 should be used to invoke `config` method of provided logic class.\n\n#### depends\n\nFunction that helps to describe a computed field with external\nmodel dependncies. Should be used in [LogicBase#computed](#logicbasecomputed).\nIt creates an instance of [ComputedField](#computedfield) with dependencies\npassed as arguments.\n\nA compute field with external dependencies is a field that should\nbe updated (re-computed) not only when the own model udpated, but\nalso when depdendency models updated.\n\n**Parameters**\n\n-   `deps` **...deps** A list of models with attached logic\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  // some logic\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  computed() {\n    return {\n      // depends on `childModel`\n      computedField: depends(this.model.childModel).compute(() => {\n        return this.model.a + this.model.childModel.b;\n      }),\n\n      // depends on `shared` model\n      computeWithShared: depends(this.shared).compute(() => {\n        return this.model.b + this.shared.someField;\n      })\n    }\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** \n\n### Extras\n\nOther pieces of MangoJuice\n\n\n#### Process\n\nThe main class of MangoJuice that ties model, logic and view together.\n\nIt works in the following way:\n\n-   You create a model for your app (object) using `createModel` of\n    the root block. The result is a plain object.\n-   Then you need to create an instance of Process and pass logic class\n    in the options object.\n-   Then you `bind` the Process instance to the model object you created on step one.\n    \"To bind Process to a model\" means that in the model will be created a hidden\n    field `__proc` with a reference to the Process instance.\n-   After that you can `run` the Process, which will execute init commands, port.\n\n`bind` and `run` also look at the object returned from [LogicBase#children](#logicbasechildren)\nand create/run Process instances for children models.\n\nMost of the time you do not need to care about all of these and just use\n[run](#run) and [mount](#mount). These small functions do everything described\nabove for you.\n\n**Examples**\n\n```javascript\nimport { Process, logicOf } from 'mangojuice-core';\n\nconst ExampleBlock = {\n  createModel() {\n    return { a: 10 };\n  },\n  Logic: class Example {\n    \\@cmd Increment(amount = 1) {\n      return { a: this.model.a + amount };\n    }\n  }\n};\n\nconst model = ExampleBlock.createModel();\nconst proc = new Process({ logic: ExampleBlock.Logic });\nproc.bind(model);\nproc.run();\nproc.exec(logicOf(model).Increment(23));\n```\n\n##### bind\n\nBind the process instance to a given model, which means that hidden\n`__proc` field will be created in the model with a reference to the\nProcess instance.\n\nAlso bind all children models – go through children definition returned\nby [LogicBase#children](#logicbasechildren), create Process for each child and bind\nit to an appropreat child model object.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to bind to the Process.\n\n##### run\n\nRun the process – run children processes, then run port and\ninit commands defined in config.\nAlso run all model observers created by [observe](#observe)\n\n##### destroy\n\nDestroy the process with unbinding from the model and cleaning\nup all the parts of the process (stop ports, computed fields).\n`__proc` field will be removed from the model object and all\nchildren objects.\n\n**Parameters**\n\n-   `deep` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then all children blocks will be destroyed.\n                             By default, if not provided then considered as true.\n\n##### exec\n\nExec a command in scope of the Process instance.\nIt will use binded model and logic object to run the\ncommand. The command could be function (command factory)\nor object ([Command](#command) instance).\n\nA command origin function could return three types of things:\n\n-   Another [Command](#command)/command factory or an array of commands\n    (an element of the array also could be another array with commands\n    or null/undefined/false). All commands will be execute in provided order.\n-   An instance of [TaskMeta](#taskmeta) (which is usually created by [task](#task)\n    helper function). The returned task will be started and do not block\n    execution of next commands in the stack.\n-   A plain object which is a model update object. The object will be merged\n    with current model.\n\nIf command is undefined or `Process` instance not binded\nto any model it will do nothing.\n\n**Parameters**\n\n-   `cmd` **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory or Command instance\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  \\@cmd BatchCommand() {\n    return [\n      1 > 2 && this.SomeCoomand,\n      this.AnotheCommand(123),\n      2 > 1 && [\n        this.AndSomeOtherCommand,\n        this.FinalCommand()\n      ]\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n  }\n  \\@cmd ModelUpdateCommand() {\n    if (Math.random() > 0.6) {\n      return { field: Date.now() };\n    }\n  }\n}\n```\n\n##### finished\n\nReturns a promise which will be resolved when all async\ntasks and related handlers in the process and all children\nprocesses will be finished.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n#### Command\n\nClass which declares a command that will be executed in the\nfuture by some [Process#exec](#processexec). It contains a function that will be\nexecuted, arguments that should be passed to the function\nand command name.\n\nThe command also keep a context that should be used to execute\na function. Usually this context is some logic instance. You\ncan bind a context to the command using [Command#bind](#commandbind) function.\n\nThe command instance is immutable, so any function that\nmakes some change in the command will produce a new command\ninstead of changing the original one.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** \n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n**Properties**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** An origin function that should be executed\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** A set of arguments that should be used\n                                 to execute the fucntion.\n\n##### exec\n\nExecute a function stored in the command instance. It passes\nstored arguments to the function and call it in stored context.\nReturns the value that was returned form the function.\n\nReturns **any** \n\n##### clone\n\nClone instance of the command\n\nReturns **[Command](#command)** \n\n##### is\n\nCheck is the command equal to some other command or have\na reference to the same origin function. Optionally you can also\ncheck that the command binded to some concrete model (using\nthe second argument).\n\nYou can use many different formats to define the command to check:\n\n-   Just a string, which should be constructed like\n    `Logic Class Name + Function Name`\n-   Command object or command factory that you can get from prorotype\n    of some logic class.\n-   Binded command object or command factory that you can get from\n    concrete model using [logicOf](#logicof) function\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Command object or command factory or command name\n-   `childModel` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Model object that should be binded to the command (optional)\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  \\@cmd SomeCommand() {}\n}\nclass MyLogic {\n  hubAfter(cmd) {\n    if (cmd.is('ChildLogic.SomeCommand')) {\n      // by command name\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand)) {\n      // by command factory\n    }\n    if (cmd.is(logicOf(this.model.child).SomeCommand)) {\n      // by binded to a concrete model command factory (commands\n      // binded for other models will be ignored)\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand, this.model.child)) {\n      // by command factory and concrete child model (commands\n      // binded for other models will be ignored)\n    }\n  }\n}\n```\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the command have same name, or same origin function\n                                and binded to same model (if second argument provided)\n\n##### appendArgs\n\nCreates a new Command instance (clone the command) and append\ngiven list of arguments to the current list of arguments.\nReturns a new Command with new list of arguments.\n\n**Parameters**\n\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of arguments that will be appened\n                               to tne new Command\n\nReturns **[Command](#command)** New command with appended arguments\n\n##### bind\n\nCreates a new Command instance and set given logic instance in it.\nAlso update command name by name of the origin function and name\nof the logic class.\n\n**Parameters**\n\n-   `logic` **[LogicBase](#logicbase)** A logic instance that should be binded to a command\n\nReturns **[Command](#command)** New command binded to given logic instance\n\n#### TaskMeta\n\nClass for declaring an async task. An instance of this object returned\nfrom [taks](taks) function.\n\nA task function is a function that could return a Promise. The resolved value\nwill be passed to a success command handler, the rejected command will be passed\nto a fail command handler.\n\nIf task function do not return a Promise, then the returned value passed to a\nsuccess command, and if the function throw an error then the error passed to\na fail command.\n\nThe task function receive at least one argument – an object with `model`, `shared`\nand `meta`. All the next arguments will be given from a command that returned a task,\nif it is not overrided by [TaskMeta#args](#taskmetaargs)\n\nBy default a task is single-threaded. It means that every call to a task will cancel\npreviously running task if it is running. You can make the task to be multi-threaded\nby [TaskMeta#multithread](#taskmetamultithread), so every call to a task won't cancel the running one.\n\nIn a context of the task function defined special `call` function. This function should\nbe used to invoke sub-tasks. It is important to use `call` to run sub-tasks because\n`call` create a cancellation point of the task – if the task cancelled, then nothing\nwill be executed after currently running `call` sub-task.\n\n`call` returns an object with `result` and `error` fields. If `error` field is not\nempty, then something weird happened in the sub-task. `call` internally have a try/catch,\nso it is not necessary to wrap it with try/catch, just check the `error` field in the\nreturned object and if it is not empty – handle it somehow (throw it, or do any custom\nerror handling)\n\nAlso in a context of the task defined a `notify` function. It is a function that execute\nnotify command if it is defined. The command executed with the same arguments as passed\nto `notify` function. You can use it to incrementally update a model while the long\ntask is executing, to show some progress for the user.\n\n**Parameters**\n\n-   `taskFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `executor` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nasync function SubTask(a, b, c) {\n  this.notify(a + b + c);\n  await this.call(delay, 100);\n  return (a / b * c);\n}\nasync function RootTask({ model }) {\n  const { result, error } = await this.call(SubTask, 1, 0, 3);\n  if (error) {\n    throw new Error('Something weird happened in subtask')\n  }\n  return result + 10;\n}\n```\n\n```javascript\nclass MyLogic {\n  \\@cmd AsyncCommand() {\n    return task(Tasks.RootTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n      .notify(this.NotifyCommand)\n  }\n}\n```\n\n##### notify\n\nSet a notify handler command. This command executed by call of `this.notify`\ninside a task with the same arguments as passed to `this.notify`\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### success\n\nSet a success handler command. Will be executed with a value returned\nfrom the task, or if the task returned a Promise – with resovled value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### fail\n\nSet a fail handler command. Will be executed with error throwed in the task,\nor if the task returned a Promise – with rejected value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### multithread\n\nDefine the task to be \"multi-thread\", so every call\nwill run in parallel with other calls of the same task\nin scope of one process (model).\n\n**Parameters**\n\n-   `val` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### engine\n\nSet task executor function. The executor function should return an object\nthat should have at least two fields: `exec` and `cancel` functions.\n`exec` should return a promise which should be resolved or rejected\nwith an object `{ result, error }`. A `cancel` function should stop\nthe task execution.\n\n**Parameters**\n\n-   `engine` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that returns\n                               `{ exec: Function, cancel: Function }` object\n\nReturns **[TaskMeta](#taskmeta)** \n\n##### args\n\nOverride arguments which will be passed to the task\nstarting from second argument. By default a task will receive\nthe same set of arguments as a task command. If this function invoked,\nthen the task will receive given arguments instead of command arguments.\n\n**Parameters**\n\n-   `args` **...any** \n\nReturns **[TaskMeta](#taskmeta)** \n\n#### DefaultLogger\n\nA class which defins a logger for tracking command execution process.\nThe default implmenetation just defines all possible logger\nmethods (log points) and print errors to the console.\nExtend this class to define your own logging functionality\n(like logging errors with Setnry or Loggly)\n\n**Examples**\n\n```javascript\n// ./index.js\nimport { DefaultLogger, run } from 'mangojuice-core';\nimport MainBlock from './blocks/MainBlock';\n\n// Implement custom logger\nclass SetnryLogger extends DefaultLogger {\n  onCatchError(error, cmd) {\n    Raven.catchException(error);\n  }\n}\n\n// Pass instance of the Logger to `run` options object.\nrun(MainBlock, { logger: new SetnryLogger() });\n```\n\n##### onStartExec\n\nThis method invoked right before anything else - as the first thing\nin [Process#exec](#processexec). Even before any [LogicBase#hubBefore](#logicbasehubbefore).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that just started execution process\n\n##### onStartHandling\n\nInvoked right before command will go through all [LogicBase#hubBefore](#logicbasehubbefore) or [LogicBase#hubAfter](#logicbasehubafter)\nup in the blocks tree. The second argument indicates is it called for [LogicBase#hubBefore](#logicbasehubbefore)\nor for [LogicBase#hubAfter](#logicbasehubafter).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that is going to go through hubs in parent blocks\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command is going through \"after\" hubs, \"before\" otherwise\n\n##### onEndHandling\n\nInvoked when the command went through all hubs and when all sync commands\nreturned from hubs was executed.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that went through all hubs\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command going through \"after\" hubs, \"before\" otherwise\n\n##### onExecuted\n\nInvoked when the command function executed and the return of the function processed –\nall returned commands executed, all async tasks started, the model updated.\nBut it invoked before the command go through \"after\" hubs.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was exectued and the return processed\n-   `result` **any** Returned object from the command's function\n\n##### onEndExec\n\nInvoked right after the command go throught \"after\" hubs. It is the final\nstage of command execution.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was fully executed and handled by parent blocks\n\n##### onCatchError\n\nInvoked if any uncaught error happened while execution of the command\nor anywhere else in the logic, like in [LogicBase#port](#logicbaseport) or in [LogicBase#computed](#logicbasecomputed).\nBy default print the error using `console.error`.\n\n**Parameters**\n\n-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** The error instance\n-   `cmd` **[Command](#command)?** Command that was executing while the error happened\n\n#### ComputedField\n\nClass for declaring computed field with model dependencies.\nGiven array shuold contain models, binded to some\nlogec. They will be passed to compute function in the same order.\nAlso they will be used to track changed and re-compute.\n\nThe class is immutable, so any call to any method will create\na new instance of `ComputedField` and the old one won't be touched.\n\n**Parameters**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** \n\n**Properties**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** An array of models with binded logic\n                                    (attached some [Process](#process))\n-   `computeFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that will be used\n                                    to compute value of the computed field.\n\n##### compute\n\nCreates a new instance of the field and set compute function in it.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that should return a value that\n                             will be used as a value for some computed field in\n                             a model. This function will be invoked with all\n                             dependency models as arguments\n\n**Examples**\n\n```javascript\n// A way to override computed field of some base logic class\n// (thanks to immutability of `ComputedField`)\nclass MyLogic extends SomeOtherLogic {\n  computed() {\n    const oldComputed = super.computed();\n    return {\n      ...oldComputed,\n\n      // Override `oldField` compute function with saved dependencies\n      // and use overrided compute function inside new compute function\n      oldField: oldComputed.compute((...deps) => {\n        return 1 > 0 || oldComputed.oldField.computeFn(...deps);\n      })\n    };\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** New instance of the ComputedField with `computeFn`\n                         set to given function.\n\n#### Mounter\n\nTo use [mount](#mount) function you need to implement a Mounter interface\nwhich should have `mount` and `unmount` functions. It is up to the developer\nhow these functions will be implemented and what view library they will use.\n\nThere is a rule that mounter and view library should follow: view of\na model should be updated only when the model updated and the update\nshouldn't touch views of children models (children views shouldn't be updated\nbecause their models is not changed).\n\nReact perfectly fits for this rule. By implementing `shuoldComponentUpdate`\nyou can control when the component should be updated and when shouldn't. In this\ncase this function should always return `false` and componenent should be\nupdated using `forceUpdate` only when the model is updated (using [observe](#observe)).\n\n**Properties**\n\n-   `mount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that should expect two arguments: model object with\n                                  attached [Process](#process) instance and [Block#View](Block#View).\n                                  It should render the model using given View (somehow).\n-   `unmount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuold unmount mounted view from DOM.\n\n**Examples**\n\n```javascript\n// Minimal react mounter which follow the rules\nclass ViewWrapper extends React.Component {\n  componentDidMount() {\n    const { model } = this.props;\n    this.stopObserver = observe(model, () => this.forceUpdate())\n  }\n  componentWillUnmount() {\n    this.stopObserver();\n  }\n  shouldComponentUpdate() {\n    return false;\n  }\n  render() {\n    const { View, model } = this.props;\n    const Logic = logicOf(model);\n    return <View model={model} Logic={Logic} />\n  }\n}\nclass ReactMounter {\n  mount(model, View) {\n    return React.render(\n      <ViewWrapper View={View} model={model} />,\n      document.querySelector('#container')\n    );\n  }\n  unmount() {\n    return React.unmountComponentAtNode(\n      document.querySelector('#container')\n    );\n  }\n}\n```\n\n#### defineCommand\n\nProvides a way to define a command in the prototype without\nusign a decorator. You should give a prototype of the logic class,\nname of the function which should be converted to a command factory\nand the decorator function (optional).\n\nIf the decorator function is not provided, then [cmd](#cmd) will be used\nby default.\n\n**Parameters**\n\n-   `proto` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Logic class prototype\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Method name that you want to convert to a command factory\n-   `decorator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** Optional decorator function\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n  // throttle 100\n  ThrottledCommand() {\n    return this.SomeCommand();\n  }\n}\n\ndefineCommand(MyLogic.prototype, 'SomeCommand');\ndefineCommand(MyLogic.prototype, 'ThrottledCommand', cmd({ throttle: 100 }));\n```\n\n#### ensureCommand\n\nReturns a [Command](#command) instance or throw an error if given\nargument can't be used to create a [Command](#command) (is not a Command\nor command factory).\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** [Command](#command) instance or command factory. When\n                                     command factory then it will be invoked with\n                                     no arguments to create a command\n\n**Examples**\n\n```javascript\nclass MyLogic() {\n  \\@cmd SomeCommand() {\n    // do something\n  }\n}\n\nconst logic = new MyLogic();\nensureCommand(logic.SomeCommand) // returns Command instance\n// equals to...\nlogic.SomeCommand()\n```\n\nReturns **[Command](#command)** \n\n#### decorateLogic\n\nBy given logic class go through prototypes chain and\ndecorate all cmd functions. Use it if you can't use decorators\nin your project\n\nIt determine that the function should be converted to a command\nfactory (decorated by [cmd](#cmd)) by its name. If the function\nstarts with uppercase letter or underscore+upper-letter, then it\nis considered as a command.\n\n**Parameters**\n\n-   `LogicClass` **[LogicBase](#logicbase)** Logic class that you want to decorate\n-   `deep` **bool** If true then it will go though prototypes chain and\n                        decorate every prototype in the chain.\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n  }\n  _SomePrivateCommand() {\n  }\n  notACommand() {\n    return 123;\n  }\n}\n\n// `SomeCommand` and `_SomePrivateCommand` will be decorated with `cmd`\n// (the prorotype will be changed in-place). `notACommand` won't\n// be decorated.\ndecorateLogic(MyLogic);\n\nconst logic = new MyLogic();\nlogic.SomeCommand() // returns Command instance\nlogic._SomePrivateCommand() // returns Command instance\nlogic.notACommand() // returns 123\n```\n\n#### handleBefore\n\nFunction adds a handler to the [Process](#process) attached to a given\nmodel that will be invoked before every command running for this\nmodel. The handler won't be invoked for commands from children\nmodels of given model.\n\nReturns a function that removes the handler from the Process\n(stop handling)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called before every own command\n\n**Examples**\n\n```javascript\nimport { handleBefore, run, logicOf } from 'mangojuice-core';\n\n// Define root and child logic\nclass ChildLogic {\n  \\@cmd ChildCommand() {}\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  \\@cmd RootCommand() {}\n}\n\n// Run block with empty models\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ childModel: {} })\n});\n\n// Adds a handler to a root model\nhandleBefore(res.model, (cmd) => console.log(cmd));\n\n// Run commands on root and child models\nres.proc.exec(logicOf(res.model).RootCommand);\nres.proc.exec(logicOf(res.model.childModel).ChildCommand);\n\n// In the console will be printed only `RootCommand` command object\n// right before the command will be executed\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### handleAfter\n\nIt is the same as [handleBefore](#handlebefore) but the handler will be invoked\n**after** every own command.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### handle\n\nAlias for [handleAfter](#handleafter)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### logicOf\n\nReturns a Logic instance attached to a given model object. The logic\ninstance stored in attached [Process](#process) instance, so it execute\n[procOf](#procof) for the model to get a [Process](#process) instance and then\nget the logic instance form a Process and return it.\n\nIf Process is not attached to the model, then an Error will be throwed.\nIf the second argument passed then it will also check that the logic\ninstance is instance of some particular class.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `logicClass` **Class?** Optional logic class to check that the logic\n                                  instance is instance of the class\n\nReturns **[LogicBase](#logicbase)** Returns a logic instance\n\n#### observe\n\nA function that adds a handler to the [Process](#process) instance attached\nto a given model, that will be invoked on every command that changed\nthe model. Useful for tracking changes to re-render a view of the model.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process) instance\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be invoked after every command\n                                that changed the model.\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object with options\n    -   `options.batched` **bool** If true then the handler will be invoked only when\n                                        the commands stack is empty and model was changed during\n                                        the stack execution. Useful to reduce amount of not necessary\n                                        view re-renderings.\n\n**Examples**\n\n```javascript\nimport { run, cmd, observe, logicOf } from 'mangojuice-core';\n\nclass MyLogic {\n  \\@cmd MultipleUpdates() {\n    return [\n      this.UpdateOne,\n      this.UpdateTwo\n    ];\n  }\n  \\@cmd UpdateOne() {\n    return { one: this.model.one + 1 };\n  }\n  \\@cmd UpdateTwo() {\n    return { two: this.model.two + 1 };\n  }\n}\n\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ one: 1, two: 1 })\n});\n\nobserve(res.model, () => console.log('not-batched'));\nobserve(res.model, () => console.log('batched'), { batched: true });\n\nres.proc.exec(logicOf(res.model).MultipleUpdates);\n\n// `not-batched` will be printed two times\n// `batched` will be printed only once\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n#### procOf\n\nGet a [Process](#process) instance attached to the given model object.\nInternally it get a `__proc` field from the given model and returns it.\n\nIf given model do not have attached Process, then an Error will be throwed,\nbut only if the second argument is not true, which ignores the error.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `ignoreError` **bool** If true then no error will be throwed if Process\n                               is not attached to the model\n\nReturns **[Process](#process)** An instance of [Process](#process) attached to the model\n\n#### bind\n\nThis function do the following:\n\n-   Creates a model object using [Block#createModel](Block#createModel). It is invoked without\n    arguments.\n-   Create a [Process](#process) instance with logic from [Block#Logic](Block#Logic)\n-   Call [Process#bind](#processbind) with created model\n\nReturns an object with created process instance, model object and given block.\nUsefull when you want to prepare the block to run but you want to run it manually.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A [Block](#block) object\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options object that could change [Process](#process) behaviour (optional, default `{}`)\n    -   `opts.logger` **[DefaultLogger](#defaultlogger)?** A custom logger instance that will be used in the\n                                               Process to track commands execution. By default\n                                               [DefaultLogger](#defaultlogger) will be used.\n    -   `opts.shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object that will be available in any logic in the\n                                          tree as `this.shared`. Could be anything you want, but\n                                          you will get more benifites if you will pass model object\n                                          with attached Process as shared object to be able to make\n                                          computed fields with depending of shared model.\n    -   `opts.args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>?** An array of arguments that will be passed to [LogicBase#config](#logicbaseconfig)\n                                               of the logic.\n    -   `opts.Process` **[Process](#process)?** A class that will be used instead of [Process](#process). By default\n                                          general [Process](#process) is used, but you can customize it for your\n                                          specific needs and pass here. Then every other process in the tree\n                                          will be an instance of this custom [Process](#process) implementation\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block)}** An object with [Process](#process) instance, model object and block that was passed to\n   the function\n\n#### hydrate\n\nThis function replace a `createModel` function in given block\nwith new function that just returns a given model. It is useful\nwhen you have some old model and just want to run everytihing with\nit (for example for server rendering, or hot module replacement)\n\n**Parameters**\n\n-   `block` **[Block](#block)** An original block\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to use\n\n**Examples**\n\n```javascript\n// Hot module replacement example\nimport MyBlock from './MyBlock';\nimport { hydrate, run } from 'mangojuice-core';\n\n// Run initial block\nlet res = run(MyBlock);\n\n// When block changed destroy the old process, hydrate a new\n// block with existing model and run hydrated new block again\nmodule.hot.accept(['./MyBlock'], () => {\n  res.proc.destroy();\n  const newBlock = hydrate(require('./MyBlock'), res.model);\n  res = run(newBlock);\n});\n```\n\nReturns **[Block](#block)** A new block with replaced `createModel` function\n                 which just returns a model that you passed as\n                 second argument.\n\n#### delay\n\nA helper function for delaying execution. Returns a Promise\nwhich will be resolved in given amount of milliseconds. You can\nuse it in [task](#task) to implement some delay in execution, for\ndebouncing for example.\n\n**Parameters**\n\n-   `ms` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** An amount of milliseconds to wait\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that resolved after given amount of milliseconds\n\n## Basic\n\nThe most common APIs that you will work with most of the time\n\n### Block\n\nBlock is a top level component in MangoJuice which consists of three parts:\n\n-   Model factory function `createModel` which should return a plain object.\n    The main requirement for this function is that it should be able to return\n    some model with zero arguments. But it can also accept some arguments\n    as well.\n-   A logic class which implements [LogicBase](#logicbase) interface\n-   A View function which is aimed to render the model created by `createModel`\n\nThe View part is optional and it could have different type depending on\nselected View library to render a model and particular binding library.\n\n**Properties**\n\n-   `Logic` **[LogicBase](#logicbase)** A logic class that should be attached to the model.\n-   `createModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuld return a plain object which\n                                      will be an init model of the block.\n-   `View` **any?** Something that some particular view library can render\n\n**Examples**\n\n```javascript\n// You can define block in short way using an object\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nrun(MyBlock);\n```\n\n```javascript\n// Or you can split it with modules (recommended)\n// ./MyBlock/index.js\nimport Logic from './Logic';\nimport View from './View';\nimport { createModel } from './Model';\nexport default { View, Logic, createModel };\nexport { View, Logic, createModel };\nexport type { Model } from './Model';\n\n// ./MyBlock/Logic.js\nimport type { Model } from './Model';\nimport { LogicBase, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  \\@cmd SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n}\n\n// ./MyBlock/Model.js\nexport type Model = { field: number };\nexport const createModel = () => ({\n  field: 1\n});\n\n// ./MyBlock/View.js\nconst MyBlockView = ({ model }) => (\n  <div>{model.field}</div>\n);\nexport default MyBlockView;\n\n// ./index.js\nimport MyBlock from './MyBlock';\nimport { run } from 'mangojuice-core';\n\nrun(MyBlock);\n```\n\n### LogicBase\n\nBasic class for every logic. It is not necessaty to inherit an actual logic\nclass from it, but for better type-checking it could be really usefull.\n\nLogic class defines:\n\n-   A set of commands that could change an associated model – methods decorated with [cmd](#cmd)\n-   What fields of the model should be associated with which logic class\n    (children blocks) – [LogicBase#children](#logicbasechildren) method\n-   A set of computed model fields – [LogicBase#computed](#logicbasecomputed) method\n-   A set of rules to handle commands from children logic – [LogicBase#hubAfter](#logicbasehubafter)\n    and [LogicBase#hubBefore](#logicbasehubbefore) methods\n-   A logic to handle external events – [LogicBase#port](#logicbaseport) method.\n\nThe logic class defines all the business-logic of some part of your application.\nThe main goal of the logic – change associated model. Check [cmd](#cmd) and [Process#exec](#processexec)\nto have a better understanding how command can be defined and how it is executed.\n\n**Properties**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object which is associated with the\n                               logic class in parent logic.\n-   `meta` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object defined in [LogicBase#config](#logicbaseconfig) method for storing\n                               some internal logic state.\n-   `shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object with some shared state, defined while\n                               run process of the app.\n\n**Examples**\n\n```javascript\n// ./blocks/MyBlock/Logic.js\n// @flow\nimport type { Model } from './Model';\nimport ChildBlock from '../ChildBlock';\nimport { Command, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  children() {\n    return { child: ChildBlock.Logic };\n  }\n  hubAfter(cmd: Command) {\n    if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n      return this.TestCommand(123);\n    }\n  }\n  \\@cmd TestCommand(arg) {\n    return { field: arg + this.model.field };\n  }\n}\n```\n\n#### config\n\nA function that defines init commands and meta object of the\nlogic. Can accept any type and number of arguments. Config\nwill take arguments passed to [child](#child) function (for example\n`child(MyLogic, 1, 2, 3)` defines that the `config` method of\n`MyLogic` will be invoked like `config(1, 2, 3)`)\n\nCould return an object with the fields:\n\n-   `initCommands` which could be an array or a single Command,\n    that will be executed every time when the logic instance created\n    and associated with some model (when [Process#run](#processrun) invoked)\n-   `meta` which could be an object with some internal state of\n    the logic\n\n**Examples**\n\n```javascript\nconfig(props) {\n  return {\n    initCommands: [ this.StartThis, this.SendThat(123) ],\n    meta: { something: props.amount }\n  };\n}\n```\n\n#### children\n\nThis function defines what logic class should be associated\nwith which model field. Should return an object where a key is\na model field name, and a value is a logic class or an object\nthat defines logic with arguments (return from [child](#child) function)\n\n**Examples**\n\n```javascript\nchildren() {\n  return {\n    searchForm: child(SearchForm.Logic, { timeout: 100 }),\n    searchResults: SearchResults.Logic\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n#### computed\n\nShould return an object which defines computed fields of the model.\nA key of the object is a model field, and value is a function or\ncomputed function definition object (return from [depends](#depends) function).\n\nComputed field is lazy, which means that it is computed on the first use\nof the field and the computation result cached until the next update\nof the model.\n\nIf you want to define a computed field which ueses in computation not\nonly fields from the own model, but maybe some values from child model,\nor from shared model, then you will need to use [depends](#depends) function to\ndefine what models used while computation to observe changes of these\nmodels to trigger an update event of the own model (to update views).\n\n**Examples**\n\n```javascript\ncomputed() {\n  return {\n    simple: () => this.model.a + this.model.b,\n    withDeps: depends(this.model.child, this.shared).compute(() => {\n      return this.model.child.a + this.shared.b + this.model.c;\n    })\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n#### port\n\nA function to handle global event, such as browser-level events,\nwebsocket, intervals. The main porpouse of the `port` is to subscribe\nto some global events, execute appropriate commands from the logic\non the events and remove the handlers when the logic was destroyed.\n\n**Parameters**\n\n-   `exec` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** It is a function that execute a passed command\n-   `destroyed` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that will be resolved when the logic destroyed\n\n**Examples**\n\n```javascript\nport(exec, destroyed) {\n  const timer = setInterval(() => {\n    exec(this.SecondPassed);\n  }, 1000);\n  destroyed.then(() => clearInterval(timer));\n}\n```\n\n#### hubAfter\n\nHub for all commands executed in the children blocks. The only\narguments is a command object that was executed.\nCould return a Command or an array of Commands that should\nbe executed next.\nMost of the time this function will look like a `switch`,\nbut maybe with some additional rules for the cases. Take a look\nto [Command#is](#commandis) function to have a better understanding how you\ncan determine that the command is exactly what you are waiting for.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was executed in some child logic\n                           or in any child of the child and so on down to\n                           the leaf of the tree.\n\n**Examples**\n\n```javascript\nhubAfter(cmd) {\n  if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n    return this.HandlerCommand(123);\n  }\n  if (cmd.is('AnotherChild.SomeAnothercommand')) {\n    return [ this.HandlerCommand(321), this.AnotherHandler ];\n  }\n}\n```\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)**\n\n#### hubBefore\n\nSame as [LogicBase#hubAfter](#logicbasehubafter), but catch commands before\nit will be actually executed, so you can compare prev and next\nmodel state for example.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)**\n\n### cmd\n\nDecorator that converts a logic method to a command factory.\nThe result function (command factory function) is a function\nthat return a [Command](#command) instnace with the decorated function\nand arguments that you will pass to a command factory function.\n\nYou can use this decorator without arguments or with an options\nargument (object)\n\nCheck [Process#exec](#processexec) to see what the origin function\ncould return to do something. If in short, it can return:\nnothing, command (or factory or array of commands), task,\nmodel update object.\n\n**Parameters**\n\n-   `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** If only this argument passed then it will be considered\n                                   as options object which can customize command behaviour.\n    -   `obj.debounce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be debounced by given amount of\n                                       milliseconds\n    -   `obj.throttle` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be throttled by given amount of\n                                       milliseconds\n    -   `obj.noInitCall` **bool** If true then debounced/throttled execution\n                                       won't start with init command call. By default\n                                       debounced/throttled command will be instantly\n                                       exected and only then wait for a chance to execute\n                                       again. With `noInitCall=true` there is no instant init\n                                       command call.\n    -   `obj.internal` **bool** Make the command invisible for parent [LogicBase#hubBefore](#logicbasehubbefore)\n                                       and [LogicBase#hubAfter](#logicbasehubafter). Use it for commands that shouldn't\n                                       be handled by hubs to increse performance.\n    -   `obj.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** By default name of the command taken from origin function. With this\n                                       option you can override the name with any other value.\n-   `methodName`\n-   `descr`\n\n**Examples**\n\n```javascript\nclass RegularLogic {\n  \\@cmd RegularCommand() {\n    // do something\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ debounce: 300 })\n  DebouncedCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 600ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300 })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300, noInitCall: true })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 1 time in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ internal: true })\n  _InternalCommand() {\n    // this command can't be caught in `hubBefore` or `hubAfter`\n    // in parent logics. Use it carefully.\n  }\n}\n```\n\nReturns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory function (if all three arguemnts passed)\n                               or a decorator function with binded options object\n                               (that you pass as a first argument)\n\n### run\n\nRun given block. It is a short-hand function for running [bind](#bind)\nand then running a Process by [Process#run](#processrun).\nAlso it returns an additional `finished` Promise which is resolved\nwhen all async tasks finished and all handler commands executed.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A block that you wan to run\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Same options as in [bind](#bind) (optional, default `{}`)\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block), finished: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)}** An object\n                 which is almost the same as returned from [bind](#bind), but with\n                 additional `finished` field, which is a Promise that will be resolved\n                 when all blocks will execute all commands and all async tasks will be\n                 finished.\n\n### mount\n\nMount running block. As third and next arguments you can pass other running\nblocks which will be stopped with the main running block (useful for HMR).\n\n**Parameters**\n\n-   `mounter` **[Mounter](#mounter)** An implementation of [Mounter](#mounter) interface\n-   `runRes` **{proc: [Process](#process), block: [Block](#block), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}** An object that returned\n                     from [run](#run) function.\n-   `otherBlocks` **...any**\n\n**Examples**\n\n```javascript\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nmount(new ReactMounter(), run(MyBlock));\n```\n\nReturns **{view: any, stop: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)}** An object with the result form [Mounter#mount](Mounter#mount)\n                 function (in `view` field) and stop function which destroy the process and\n                 unmount a view using [Mounter#unmount](Mounter#unmount)\n\n### task\n\nCreates a [TaskMeta](#taskmeta) object that could be returned from\nasync task command. It describes the task that should be executed.\n\nFor more information what the **Task** is and how it should be implemented\ntake a look to [TaskMeta](#taskmeta).\n\n**Parameters**\n\n-   `taskFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that could return a Promise\n\n**Properties**\n\n-   `CANCEL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A symbol that you can use to make a promise \"cancellable\"\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n### cancel\n\nThis function should be used to cancel async [task](#task) execution.\nAlso it can cancel the debounced/throttled command.\n\n-   In case with task, if task was executing while you call a cancel command,\n    the task will be cancelled (execution stopped). Otherwise nothing will happen.\n-   In case with debounced/throttled command, if the command scheduled to be executed\n    then the schedule timer will be cleared and the command won't be executed.\n    If the command is not scheduled then nothing happens.\n\nTo use it just pass a command or command factory as a first argument\nand return it from some other command.\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Command or command factory that you wan to cancel. Could\n                                    be a command that returns [task](#task) or debounced/throttled\n                                    command\n\n**Examples**\n\n```javascript\nclass SomeLogic {\n  \\@cmd CancelSomethingCommand() {\n    return [\n      cancel(this.TaskCommand),\n      cancel(this.DebounceCommand)\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask);\n  }\n  \\@cmd({ debounce: 300 })\n  DebounceCommand() {\n    // do something\n  }\n}\n```\n\nReturns **[Command](#command)** Returns a new command that will cancel the execution of the command\n                  passed as an argument.\n\n### child\n\nCreates an object which describes child logic which will be attached\nto some model field. Should be used in [LogicBase#children](#logicbasechildren) to\ndefine a logic that should be instantiated with some arguments passed\nto [LogicBase#config](#logicbaseconfig).\n\n**Parameters**\n\n-   `logicClass` **[LogicBase](#logicbase)** Class that imlements [LogicBase](#logicbase) interface\n-   `args` **...any**\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  config(amount) {\n    return { meta: { amount } };\n  }\n}\nclass RootLogic {\n  children() {\n    return {\n      modelField: child(ChildLogic, 10)\n      // `config` of `ChildLogic` will be invoked with\n      // `10` as a first argument\n    }\n  }\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object that contains a logic class and an arguments array that\n                 should be used to invoke `config` method of provided logic class.\n\n### depends\n\nFunction that helps to describe a computed field with external\nmodel dependncies. Should be used in [LogicBase#computed](#logicbasecomputed).\nIt creates an instance of [ComputedField](#computedfield) with dependencies\npassed as arguments.\n\nA compute field with external dependencies is a field that should\nbe updated (re-computed) not only when the own model udpated, but\nalso when depdendency models updated.\n\n**Parameters**\n\n-   `deps` **...deps** A list of models with attached logic\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  // some logic\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  computed() {\n    return {\n      // depends on `childModel`\n      computedField: depends(this.model.childModel).compute(() => {\n        return this.model.a + this.model.childModel.b;\n      }),\n\n      // depends on `shared` model\n      computeWithShared: depends(this.shared).compute(() => {\n        return this.model.b + this.shared.someField;\n      })\n    }\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)**\n\n## Extras\n\nOther pieces of MangoJuice\n\n### Process\n\nThe main class of MangoJuice that ties model, logic and view together.\n\nIt works in the following way:\n\n-   You create a model for your app (object) using `createModel` of\n    the root block. The result is a plain object.\n-   Then you need to create an instance of Process and pass logic class\n    in the options object.\n-   Then you `bind` the Process instance to the model object you created on step one.\n    \"To bind Process to a model\" means that in the model will be created a hidden\n    field `__proc` with a reference to the Process instance.\n-   After that you can `run` the Process, which will execute init commands, port.\n\n`bind` and `run` also look at the object returned from [LogicBase#children](#logicbasechildren)\nand create/run Process instances for children models.\n\nMost of the time you do not need to care about all of these and just use\n[run](#run) and [mount](#mount). These small functions do everything described\nabove for you.\n\n**Examples**\n\n```javascript\nimport { Process, logicOf } from 'mangojuice-core';\n\nconst ExampleBlock = {\n  createModel() {\n    return { a: 10 };\n  },\n  Logic: class Example {\n    \\@cmd Increment(amount = 1) {\n      return { a: this.model.a + amount };\n    }\n  }\n};\n\nconst model = ExampleBlock.createModel();\nconst proc = new Process({ logic: ExampleBlock.Logic });\nproc.bind(model);\nproc.run();\nproc.exec(logicOf(model).Increment(23));\n```\n\n#### bind\n\nBind the process instance to a given model, which means that hidden\n`__proc` field will be created in the model with a reference to the\nProcess instance.\n\nAlso bind all children models – go through children definition returned\nby [LogicBase#children](#logicbasechildren), create Process for each child and bind\nit to an appropreat child model object.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to bind to the Process.\n\n#### run\n\nRun the process – run children processes, then run port and\ninit commands defined in config.\nAlso run all model observers created by [observe](#observe)\n\n#### destroy\n\nDestroy the process with unbinding from the model and cleaning\nup all the parts of the process (stop ports, computed fields).\n`__proc` field will be removed from the model object and all\nchildren objects.\n\n**Parameters**\n\n-   `deep` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then all children blocks will be destroyed.\n                             By default, if not provided then considered as true.\n\n#### exec\n\nExec a command in scope of the Process instance.\nIt will use binded model and logic object to run the\ncommand. The command could be function (command factory)\nor object ([Command](#command) instance).\n\nA command origin function could return three types of things:\n\n-   Another [Command](#command)/command factory or an array of commands\n    (an element of the array also could be another array with commands\n    or null/undefined/false). All commands will be execute in provided order.\n-   An instance of [TaskMeta](#taskmeta) (which is usually created by [task](#task)\n    helper function). The returned task will be started and do not block\n    execution of next commands in the stack.\n-   A plain object which is a model update object. The object will be merged\n    with current model.\n\nIf command is undefined or `Process` instance not binded\nto any model it will do nothing.\n\n**Parameters**\n\n-   `cmd` **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory or Command instance\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  \\@cmd BatchCommand() {\n    return [\n      1 > 2 && this.SomeCoomand,\n      this.AnotheCommand(123),\n      2 > 1 && [\n        this.AndSomeOtherCommand,\n        this.FinalCommand()\n      ]\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n  }\n  \\@cmd ModelUpdateCommand() {\n    if (Math.random() > 0.6) {\n      return { field: Date.now() };\n    }\n  }\n}\n```\n\n#### finished\n\nReturns a promise which will be resolved when all async\ntasks and related handlers in the process and all children\nprocesses will be finished.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**\n\n### Command\n\nClass which declares a command that will be executed in the\nfuture by some [Process#exec](#processexec). It contains a function that will be\nexecuted, arguments that should be passed to the function\nand command name.\n\nThe command also keep a context that should be used to execute\na function. Usually this context is some logic instance. You\ncan bind a context to the command using [Command#bind](#commandbind) function.\n\nThe command instance is immutable, so any function that\nmakes some change in the command will produce a new command\ninstead of changing the original one.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>**\n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n\n**Properties**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** An origin function that should be executed\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** A set of arguments that should be used\n                                 to execute the fucntion.\n\n#### exec\n\nExecute a function stored in the command instance. It passes\nstored arguments to the function and call it in stored context.\nReturns the value that was returned form the function.\n\nReturns **any**\n\n#### clone\n\nClone instance of the command\n\nReturns **[Command](#command)**\n\n#### is\n\nCheck is the command equal to some other command or have\na reference to the same origin function. Optionally you can also\ncheck that the command binded to some concrete model (using\nthe second argument).\n\nYou can use many different formats to define the command to check:\n\n-   Just a string, which should be constructed like\n    `Logic Class Name + Function Name`\n-   Command object or command factory that you can get from prorotype\n    of some logic class.\n-   Binded command object or command factory that you can get from\n    concrete model using [logicOf](#logicof) function\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Command object or command factory or command name\n-   `childModel` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Model object that should be binded to the command (optional)\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  \\@cmd SomeCommand() {}\n}\nclass MyLogic {\n  hubAfter(cmd) {\n    if (cmd.is('ChildLogic.SomeCommand')) {\n      // by command name\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand)) {\n      // by command factory\n    }\n    if (cmd.is(logicOf(this.model.child).SomeCommand)) {\n      // by binded to a concrete model command factory (commands\n      // binded for other models will be ignored)\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand, this.model.child)) {\n      // by command factory and concrete child model (commands\n      // binded for other models will be ignored)\n    }\n  }\n}\n```\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the command have same name, or same origin function\n                                and binded to same model (if second argument provided)\n\n#### appendArgs\n\nCreates a new Command instance (clone the command) and append\ngiven list of arguments to the current list of arguments.\nReturns a new Command with new list of arguments.\n\n**Parameters**\n\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of arguments that will be appened\n                               to tne new Command\n\nReturns **[Command](#command)** New command with appended arguments\n\n#### bind\n\nCreates a new Command instance and set given logic instance in it.\nAlso update command name by name of the origin function and name\nof the logic class.\n\n**Parameters**\n\n-   `logic` **[LogicBase](#logicbase)** A logic instance that should be binded to a command\n\nReturns **[Command](#command)** New command binded to given logic instance\n\n### TaskMeta\n\nClass for declaring an async task. An instance of this object returned\nfrom [taks](taks) function.\n\nA task function is a function that could return a Promise. The resolved value\nwill be passed to a success command handler, the rejected command will be passed\nto a fail command handler.\n\nIf task function do not return a Promise, then the returned value passed to a\nsuccess command, and if the function throw an error then the error passed to\na fail command.\n\nThe task function receive at least one argument – an object with `model`, `shared`\nand `meta`. All the next arguments will be given from a command that returned a task,\nif it is not overrided by [TaskMeta#args](#taskmetaargs)\n\nBy default a task is single-threaded. It means that every call to a task will cancel\npreviously running task if it is running. You can make the task to be multi-threaded\nby [TaskMeta#multithread](#taskmetamultithread), so every call to a task won't cancel the running one.\n\nIn a context of the task function defined special `call` function. This function should\nbe used to invoke sub-tasks. It is important to use `call` to run sub-tasks because\n`call` create a cancellation point of the task – if the task cancelled, then nothing\nwill be executed after currently running `call` sub-task.\n\n`call` returns an object with `result` and `error` fields. If `error` field is not\nempty, then something weird happened in the sub-task. `call` internally have a try/catch,\nso it is not necessary to wrap it with try/catch, just check the `error` field in the\nreturned object and if it is not empty – handle it somehow (throw it, or do any custom\nerror handling)\n\nAlso in a context of the task defined a `notify` function. It is a function that execute\nnotify command if it is defined. The command executed with the same arguments as passed\nto `notify` function. You can use it to incrementally update a model while the long\ntask is executing, to show some progress for the user.\n\n**Parameters**\n\n-   `taskFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n-   `executor` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n\n**Examples**\n\n```javascript\nasync function SubTask(a, b, c) {\n  this.notify(a + b + c);\n  await this.call(delay, 100);\n  return (a / b * c);\n}\nasync function RootTask({ model }) {\n  const { result, error } = await this.call(SubTask, 1, 0, 3);\n  if (error) {\n    throw new Error('Something weird happened in subtask')\n  }\n  return result + 10;\n}\n```\n\n```javascript\nclass MyLogic {\n  \\@cmd AsyncCommand() {\n    return task(Tasks.RootTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n      .notify(this.NotifyCommand)\n  }\n}\n```\n\n#### notify\n\nSet a notify handler command. This command executed by call of `this.notify`\ninside a task with the same arguments as passed to `this.notify`\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### success\n\nSet a success handler command. Will be executed with a value returned\nfrom the task, or if the task returned a Promise – with resovled value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### fail\n\nSet a fail handler command. Will be executed with error throwed in the task,\nor if the task returned a Promise – with rejected value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### multithread\n\nDefine the task to be \"multi-thread\", so every call\nwill run in parallel with other calls of the same task\nin scope of one process (model).\n\n**Parameters**\n\n-   `val` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### engine\n\nSet task executor function. The executor function should return an object\nthat should have at least two fields: `exec` and `cancel` functions.\n`exec` should return a promise which should be resolved or rejected\nwith an object `{ result, error }`. A `cancel` function should stop\nthe task execution.\n\n**Parameters**\n\n-   `engine` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that returns\n                               `{ exec: Function, cancel: Function }` object\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### args\n\nOverride arguments which will be passed to the task\nstarting from second argument. By default a task will receive\nthe same set of arguments as a task command. If this function invoked,\nthen the task will receive given arguments instead of command arguments.\n\n**Parameters**\n\n-   `args` **...any**\n\nReturns **[TaskMeta](#taskmeta)**\n\n### DefaultLogger\n\nA class which defins a logger for tracking command execution process.\nThe default implmenetation just defines all possible logger\nmethods (log points) and print errors to the console.\nExtend this class to define your own logging functionality\n(like logging errors with Setnry or Loggly)\n\n**Examples**\n\n```javascript\n// ./index.js\nimport { DefaultLogger, run } from 'mangojuice-core';\nimport MainBlock from './blocks/MainBlock';\n\n// Implement custom logger\nclass SetnryLogger extends DefaultLogger {\n  onCatchError(error, cmd) {\n    Raven.catchException(error);\n  }\n}\n\n// Pass instance of the Logger to `run` options object.\nrun(MainBlock, { logger: new SetnryLogger() });\n```\n\n#### onStartExec\n\nThis method invoked right before anything else - as the first thing\nin [Process#exec](#processexec). Even before any [LogicBase#hubBefore](#logicbasehubbefore).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that just started execution process\n\n#### onStartHandling\n\nInvoked right before command will go through all [LogicBase#hubBefore](#logicbasehubbefore) or [LogicBase#hubAfter](#logicbasehubafter)\nup in the blocks tree. The second argument indicates is it called for [LogicBase#hubBefore](#logicbasehubbefore)\nor for [LogicBase#hubAfter](#logicbasehubafter).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that is going to go through hubs in parent blocks\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command is going through \"after\" hubs, \"before\" otherwise\n\n#### onEndHandling\n\nInvoked when the command went through all hubs and when all sync commands\nreturned from hubs was executed.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that went through all hubs\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command going through \"after\" hubs, \"before\" otherwise\n\n#### onExecuted\n\nInvoked when the command function executed and the return of the function processed –\nall returned commands executed, all async tasks started, the model updated.\nBut it invoked before the command go through \"after\" hubs.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was exectued and the return processed\n-   `result` **any** Returned object from the command's function\n\n#### onEndExec\n\nInvoked right after the command go throught \"after\" hubs. It is the final\nstage of command execution.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was fully executed and handled by parent blocks\n\n#### onCatchError\n\nInvoked if any uncaught error happened while execution of the command\nor anywhere else in the logic, like in [LogicBase#port](#logicbaseport) or in [LogicBase#computed](#logicbasecomputed).\nBy default print the error using `console.error`.\n\n**Parameters**\n\n-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** The error instance\n-   `cmd` **[Command](#command)?** Command that was executing while the error happened\n\n### ComputedField\n\nClass for declaring computed field with model dependencies.\nGiven array shuold contain models, binded to some\nlogec. They will be passed to compute function in the same order.\nAlso they will be used to track changed and re-compute.\n\nThe class is immutable, so any call to any method will create\na new instance of `ComputedField` and the old one won't be touched.\n\n**Parameters**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**\n\n**Properties**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** An array of models with binded logic\n                                    (attached some [Process](#process))\n-   `computeFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that will be used\n                                    to compute value of the computed field.\n\n#### compute\n\nCreates a new instance of the field and set compute function in it.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that should return a value that\n                             will be used as a value for some computed field in\n                             a model. This function will be invoked with all\n                             dependency models as arguments\n\n**Examples**\n\n```javascript\n// A way to override computed field of some base logic class\n// (thanks to immutability of `ComputedField`)\nclass MyLogic extends SomeOtherLogic {\n  computed() {\n    const oldComputed = super.computed();\n    return {\n      ...oldComputed,\n\n      // Override `oldField` compute function with saved dependencies\n      // and use overrided compute function inside new compute function\n      oldField: oldComputed.compute((...deps) => {\n        return 1 > 0 || oldComputed.oldField.computeFn(...deps);\n      })\n    };\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** New instance of the ComputedField with `computeFn`\n                         set to given function.\n\n### Mounter\n\nTo use [mount](#mount) function you need to implement a Mounter interface\nwhich should have `mount` and `unmount` functions. It is up to the developer\nhow these functions will be implemented and what view library they will use.\n\nThere is a rule that mounter and view library should follow: view of\na model should be updated only when the model updated and the update\nshouldn't touch views of children models (children views shouldn't be updated\nbecause their models is not changed).\n\nReact perfectly fits for this rule. By implementing `shuoldComponentUpdate`\nyou can control when the component should be updated and when shouldn't. In this\ncase this function should always return `false` and componenent should be\nupdated using `forceUpdate` only when the model is updated (using [observe](#observe)).\n\n**Properties**\n\n-   `mount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that should expect two arguments: model object with\n                                  attached [Process](#process) instance and [Block#View](Block#View).\n                                  It should render the model using given View (somehow).\n-   `unmount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuold unmount mounted view from DOM.\n\n**Examples**\n\n```javascript\n// Minimal react mounter which follow the rules\nclass ViewWrapper extends React.Component {\n  componentDidMount() {\n    const { model } = this.props;\n    this.stopObserver = observe(model, () => this.forceUpdate())\n  }\n  componentWillUnmount() {\n    this.stopObserver();\n  }\n  shouldComponentUpdate() {\n    return false;\n  }\n  render() {\n    const { View, model } = this.props;\n    const Logic = logicOf(model);\n    return <View model={model} Logic={Logic} />\n  }\n}\nclass ReactMounter {\n  mount(model, View) {\n    return React.render(\n      <ViewWrapper View={View} model={model} />,\n      document.querySelector('#container')\n    );\n  }\n  unmount() {\n    return React.unmountComponentAtNode(\n      document.querySelector('#container')\n    );\n  }\n}\n```\n\n### defineCommand\n\nProvides a way to define a command in the prototype without\nusign a decorator. You should give a prototype of the logic class,\nname of the function which should be converted to a command factory\nand the decorator function (optional).\n\nIf the decorator function is not provided, then [cmd](#cmd) will be used\nby default.\n\n**Parameters**\n\n-   `proto` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Logic class prototype\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Method name that you want to convert to a command factory\n-   `decorator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** Optional decorator function\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n  // throttle 100\n  ThrottledCommand() {\n    return this.SomeCommand();\n  }\n}\n\ndefineCommand(MyLogic.prototype, 'SomeCommand');\ndefineCommand(MyLogic.prototype, 'ThrottledCommand', cmd({ throttle: 100 }));\n```\n\n### ensureCommand\n\nReturns a [Command](#command) instance or throw an error if given\nargument can't be used to create a [Command](#command) (is not a Command\nor command factory).\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** [Command](#command) instance or command factory. When\n                                     command factory then it will be invoked with\n                                     no arguments to create a command\n\n**Examples**\n\n```javascript\nclass MyLogic() {\n  \\@cmd SomeCommand() {\n    // do something\n  }\n}\n\nconst logic = new MyLogic();\nensureCommand(logic.SomeCommand) // returns Command instance\n// equals to...\nlogic.SomeCommand()\n```\n\nReturns **[Command](#command)**\n\n### decorateLogic\n\nBy given logic class go through prototypes chain and\ndecorate all cmd functions. Use it if you can't use decorators\nin your project\n\nIt determine that the function should be converted to a command\nfactory (decorated by [cmd](#cmd)) by its name. If the function\nstarts with uppercase letter or underscore+upper-letter, then it\nis considered as a command.\n\n**Parameters**\n\n-   `LogicClass` **[LogicBase](#logicbase)** Logic class that you want to decorate\n-   `deep` **bool** If true then it will go though prototypes chain and\n                        decorate every prototype in the chain.\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n  }\n  _SomePrivateCommand() {\n  }\n  notACommand() {\n    return 123;\n  }\n}\n\n// `SomeCommand` and `_SomePrivateCommand` will be decorated with `cmd`\n// (the prorotype will be changed in-place). `notACommand` won't\n// be decorated.\ndecorateLogic(MyLogic);\n\nconst logic = new MyLogic();\nlogic.SomeCommand() // returns Command instance\nlogic._SomePrivateCommand() // returns Command instance\nlogic.notACommand() // returns 123\n```\n\n### handleBefore\n\nFunction adds a handler to the [Process](#process) attached to a given\nmodel that will be invoked before every command running for this\nmodel. The handler won't be invoked for commands from children\nmodels of given model.\n\nReturns a function that removes the handler from the Process\n(stop handling)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called before every own command\n\n**Examples**\n\n```javascript\nimport { handleBefore, run, logicOf } from 'mangojuice-core';\n\n// Define root and child logic\nclass ChildLogic {\n  \\@cmd ChildCommand() {}\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  \\@cmd RootCommand() {}\n}\n\n// Run block with empty models\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ childModel: {} })\n});\n\n// Adds a handler to a root model\nhandleBefore(res.model, (cmd) => console.log(cmd));\n\n// Run commands on root and child models\nres.proc.exec(logicOf(res.model).RootCommand);\nres.proc.exec(logicOf(res.model.childModel).ChildCommand);\n\n// In the console will be printed only `RootCommand` command object\n// right before the command will be executed\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### handleAfter\n\nIt is the same as [handleBefore](#handlebefore) but the handler will be invoked\n**after** every own command.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### handle\n\nAlias for [handleAfter](#handleafter)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### logicOf\n\nReturns a Logic instance attached to a given model object. The logic\ninstance stored in attached [Process](#process) instance, so it execute\n[procOf](#procof) for the model to get a [Process](#process) instance and then\nget the logic instance form a Process and return it.\n\nIf Process is not attached to the model, then an Error will be throwed.\nIf the second argument passed then it will also check that the logic\ninstance is instance of some particular class.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `logicClass` **Class?** Optional logic class to check that the logic\n                                  instance is instance of the class\n\nReturns **[LogicBase](#logicbase)** Returns a logic instance\n\n### observe\n\nA function that adds a handler to the [Process](#process) instance attached\nto a given model, that will be invoked on every command that changed\nthe model. Useful for tracking changes to re-render a view of the model.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process) instance\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be invoked after every command\n                                that changed the model.\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object with options\n    -   `options.batched` **bool** If true then the handler will be invoked only when\n                                        the commands stack is empty and model was changed during\n                                        the stack execution. Useful to reduce amount of not necessary\n                                        view re-renderings.\n\n**Examples**\n\n```javascript\nimport { run, cmd, observe, logicOf } from 'mangojuice-core';\n\nclass MyLogic {\n  \\@cmd MultipleUpdates() {\n    return [\n      this.UpdateOne,\n      this.UpdateTwo\n    ];\n  }\n  \\@cmd UpdateOne() {\n    return { one: this.model.one + 1 };\n  }\n  \\@cmd UpdateTwo() {\n    return { two: this.model.two + 1 };\n  }\n}\n\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ one: 1, two: 1 })\n});\n\nobserve(res.model, () => console.log('not-batched'));\nobserve(res.model, () => console.log('batched'), { batched: true });\n\nres.proc.exec(logicOf(res.model).MultipleUpdates);\n\n// `not-batched` will be printed two times\n// `batched` will be printed only once\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n\n### procOf\n\nGet a [Process](#process) instance attached to the given model object.\nInternally it get a `__proc` field from the given model and returns it.\n\nIf given model do not have attached Process, then an Error will be throwed,\nbut only if the second argument is not true, which ignores the error.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `ignoreError` **bool** If true then no error will be throwed if Process\n                               is not attached to the model\n\nReturns **[Process](#process)** An instance of [Process](#process) attached to the model\n\n### bind\n\nThis function do the following:\n\n-   Creates a model object using [Block#createModel](Block#createModel). It is invoked without\n    arguments.\n-   Create a [Process](#process) instance with logic from [Block#Logic](Block#Logic)\n-   Call [Process#bind](#processbind) with created model\n\nReturns an object with created process instance, model object and given block.\nUsefull when you want to prepare the block to run but you want to run it manually.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A [Block](#block) object\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options object that could change [Process](#process) behaviour (optional, default `{}`)\n    -   `opts.logger` **[DefaultLogger](#defaultlogger)?** A custom logger instance that will be used in the\n                                               Process to track commands execution. By default\n                                               [DefaultLogger](#defaultlogger) will be used.\n    -   `opts.shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object that will be available in any logic in the\n                                          tree as `this.shared`. Could be anything you want, but\n                                          you will get more benifites if you will pass model object\n                                          with attached Process as shared object to be able to make\n                                          computed fields with depending of shared model.\n    -   `opts.args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>?** An array of arguments that will be passed to [LogicBase#config](#logicbaseconfig)\n                                               of the logic.\n    -   `opts.Process` **[Process](#process)?** A class that will be used instead of [Process](#process). By default\n                                          general [Process](#process) is used, but you can customize it for your\n                                          specific needs and pass here. Then every other process in the tree\n                                          will be an instance of this custom [Process](#process) implementation\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block)}** An object with [Process](#process) instance, model object and block that was passed to\n   the function\n\n### hydrate\n\nThis function replace a `createModel` function in given block\nwith new function that just returns a given model. It is useful\nwhen you have some old model and just want to run everytihing with\nit (for example for server rendering, or hot module replacement)\n\n**Parameters**\n\n-   `block` **[Block](#block)** An original block\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to use\n\n**Examples**\n\n```javascript\n// Hot module replacement example\nimport MyBlock from './MyBlock';\nimport { hydrate, run } from 'mangojuice-core';\n\n// Run initial block\nlet res = run(MyBlock);\n\n// When block changed destroy the old process, hydrate a new\n// block with existing model and run hydrated new block again\nmodule.hot.accept(['./MyBlock'], () => {\n  res.proc.destroy();\n  const newBlock = hydrate(require('./MyBlock'), res.model);\n  res = run(newBlock);\n});\n```\n\nReturns **[Block](#block)** A new block with replaced `createModel` function\n                 which just returns a model that you passed as\n                 second argument.\n\n### delay\n\nA helper function for delaying execution. Returns a Promise\nwhich will be resolved in given amount of milliseconds. You can\nuse it in [task](#task) to implement some delay in execution, for\ndebouncing for example.\n\n**Parameters**\n\n-   `ms` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** An amount of milliseconds to wait\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that resolved after given amount of milliseconds\n","readmeFilename":"README.md","_id":"mangojuice-core@2.0.0-0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-4lXWshAHIXGwOuyVLgZTqKRvAJpCzNB0a6l0OqPYw0QaHAMARV74uUhFXe0il7vwPFEwonZU2xu5SQ57CqYjBg==","shasum":"a66866d0ebad9b68333970ff1db119faf3b09738","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-2.0.0-0.tgz","fileCount":34,"unpackedSize":1872459,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDuZ0D7MdlbohnBWBQ4MF75IXw7qQq8q6hU+WTKR+SiCgIhAL6FzNEXLW9vY6q4xNugaizggfBSOT6JPfP0eOQsU6TS"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core_2.0.0-0_1519466176641_0.7278382443141973"},"_hasShrinkwrap":false},"2.0.0-y.0":{"name":"mangojuice-core","version":"2.0.0-y.0","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"readme":"# MangoJuice Core\n\n## Reference\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n#### Table of Contents\n\n-   [Basic](#basic)\n    -   [Block](#block)\n    -   [LogicBase](#logicbase)\n        -   [config](#config)\n        -   [children](#children)\n        -   [computed](#computed)\n        -   [port](#port)\n        -   [hubAfter](#hubafter)\n        -   [hubBefore](#hubbefore)\n    -   [cmd](#cmd)\n    -   [run](#run)\n    -   [mount](#mount)\n    -   [task](#task)\n    -   [cancel](#cancel)\n    -   [child](#child)\n    -   [depends](#depends)\n-   [Extras](#extras)\n    -   [Process](#process)\n        -   [bind](#bind)\n        -   [run](#run-1)\n        -   [destroy](#destroy)\n        -   [exec](#exec)\n        -   [finished](#finished)\n    -   [Command](#command)\n        -   [exec](#exec-1)\n        -   [clone](#clone)\n        -   [is](#is)\n        -   [appendArgs](#appendargs)\n        -   [bind](#bind-1)\n    -   [TaskMeta](#taskmeta)\n        -   [notify](#notify)\n        -   [success](#success)\n        -   [fail](#fail)\n        -   [multithread](#multithread)\n        -   [engine](#engine)\n        -   [args](#args)\n    -   [DefaultLogger](#defaultlogger)\n        -   [onStartExec](#onstartexec)\n        -   [onStartHandling](#onstarthandling)\n        -   [onEndHandling](#onendhandling)\n        -   [onExecuted](#onexecuted)\n        -   [onEndExec](#onendexec)\n        -   [onCatchError](#oncatcherror)\n    -   [ComputedField](#computedfield)\n        -   [compute](#compute)\n    -   [Mounter](#mounter)\n    -   [defineCommand](#definecommand)\n    -   [ensureCommand](#ensurecommand)\n    -   [decorateLogic](#decoratelogic)\n    -   [handleBefore](#handlebefore)\n    -   [handleAfter](#handleafter)\n    -   [handle](#handle)\n    -   [logicOf](#logicof)\n    -   [observe](#observe)\n    -   [procOf](#procof)\n    -   [bind](#bind-2)\n    -   [hydrate](#hydrate)\n    -   [delay](#delay)\n\n### Basic\n\nThe most common APIs that you will work with most of the time\n\n\n#### Block\n\nBlock is a top level component in MangoJuice which consists of three parts:\n\n-   Model factory function `createModel` which should return a plain object.\n    The main requirement for this function is that it should be able to return\n    some model with zero arguments. But it can also accept some arguments\n    as well.\n-   A logic class which implements [LogicBase](#logicbase) interface\n-   A View function which is aimed to render the model created by `createModel`\n\nThe View part is optional and it could have different type depending on\nselected View library to render a model and particular binding library.\n\n**Properties**\n\n-   `Logic` **[LogicBase](#logicbase)** A logic class that should be attached to the model.\n-   `createModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuld return a plain object which\n                                      will be an init model of the block.\n-   `View` **any?** Something that some particular view library can render\n\n**Examples**\n\n```javascript\n// You can define block in short way using an object\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nrun(MyBlock);\n```\n\n```javascript\n// Or you can split it with modules (recommended)\n// ./MyBlock/index.js\nimport Logic from './Logic';\nimport View from './View';\nimport { createModel } from './Model';\nexport default { View, Logic, createModel };\nexport { View, Logic, createModel };\nexport type { Model } from './Model';\n\n// ./MyBlock/Logic.js\nimport type { Model } from './Model';\nimport { LogicBase, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  \\@cmd SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n}\n\n// ./MyBlock/Model.js\nexport type Model = { field: number };\nexport const createModel = () => ({\n  field: 1\n});\n\n// ./MyBlock/View.js\nconst MyBlockView = ({ model }) => (\n  <div>{model.field}</div>\n);\nexport default MyBlockView;\n\n// ./index.js\nimport MyBlock from './MyBlock';\nimport { run } from 'mangojuice-core';\n\nrun(MyBlock);\n```\n\n#### LogicBase\n\nBasic class for every logic. It is not necessaty to inherit an actual logic\nclass from it, but for better type-checking it could be really usefull.\n\nLogic class defines:\n\n-   A set of commands that could change an associated model – methods decorated with [cmd](#cmd)\n-   What fields of the model should be associated with which logic class\n    (children blocks) – [LogicBase#children](#logicbasechildren) method\n-   A set of computed model fields – [LogicBase#computed](#logicbasecomputed) method\n-   A set of rules to handle commands from children logic – [LogicBase#hubAfter](#logicbasehubafter)\n    and [LogicBase#hubBefore](#logicbasehubbefore) methods\n-   A logic to handle external events – [LogicBase#port](#logicbaseport) method.\n\nThe logic class defines all the business-logic of some part of your application.\nThe main goal of the logic – change associated model. Check [cmd](#cmd) and [Process#exec](#processexec)\nto have a better understanding how command can be defined and how it is executed.\n\n**Properties**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object which is associated with the\n                               logic class in parent logic.\n-   `meta` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object defined in [LogicBase#config](#logicbaseconfig) method for storing\n                               some internal logic state.\n-   `shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object with some shared state, defined while\n                               run process of the app.\n\n**Examples**\n\n```javascript\n// ./blocks/MyBlock/Logic.js\n// @flow\nimport type { Model } from './Model';\nimport ChildBlock from '../ChildBlock';\nimport { Command, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  children() {\n    return { child: ChildBlock.Logic };\n  }\n  hubAfter(cmd: Command) {\n    if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n      return this.TestCommand(123);\n    }\n  }\n  \\@cmd TestCommand(arg) {\n    return { field: arg + this.model.field };\n  }\n}\n```\n\n##### config\n\nA function that defines init commands and meta object of the\nlogic. Can accept any type and number of arguments. Config\nwill take arguments passed to [child](#child) function (for example\n`child(MyLogic, 1, 2, 3)` defines that the `config` method of\n`MyLogic` will be invoked like `config(1, 2, 3)`)\n\nCould return an object with the fields:\n\n-   `initCommands` which could be an array or a single Command,\n    that will be executed every time when the logic instance created\n    and associated with some model (when [Process#run](#processrun) invoked)\n-   `meta` which could be an object with some internal state of\n    the logic\n\n**Examples**\n\n```javascript\nconfig(props) {\n  return {\n    initCommands: [ this.StartThis, this.SendThat(123) ],\n    meta: { something: props.amount }\n  };\n}\n```\n\n##### children\n\nThis function defines what logic class should be associated\nwith which model field. Should return an object where a key is\na model field name, and a value is a logic class or an object\nthat defines logic with arguments (return from [child](#child) function)\n\n**Examples**\n\n```javascript\nchildren() {\n  return {\n    searchForm: child(SearchForm.Logic, { timeout: 100 }),\n    searchResults: SearchResults.Logic\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n##### computed\n\nShould return an object which defines computed fields of the model.\nA key of the object is a model field, and value is a function or\ncomputed function definition object (return from [depends](#depends) function).\n\nComputed field is lazy, which means that it is computed on the first use\nof the field and the computation result cached until the next update\nof the model.\n\nIf you want to define a computed field which ueses in computation not\nonly fields from the own model, but maybe some values from child model,\nor from shared model, then you will need to use [depends](#depends) function to\ndefine what models used while computation to observe changes of these\nmodels to trigger an update event of the own model (to update views).\n\n**Examples**\n\n```javascript\ncomputed() {\n  return {\n    simple: () => this.model.a + this.model.b,\n    withDeps: depends(this.model.child, this.shared).compute(() => {\n      return this.model.child.a + this.shared.b + this.model.c;\n    })\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n##### port\n\nA function to handle global event, such as browser-level events,\nwebsocket, intervals. The main porpouse of the `port` is to subscribe\nto some global events, execute appropriate commands from the logic\non the events and remove the handlers when the logic was destroyed.\n\n**Parameters**\n\n-   `exec` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** It is a function that execute a passed command\n-   `destroyed` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that will be resolved when the logic destroyed\n\n**Examples**\n\n```javascript\nport(exec, destroyed) {\n  const timer = setInterval(() => {\n    exec(this.SecondPassed);\n  }, 1000);\n  destroyed.then(() => clearInterval(timer));\n}\n```\n\n##### hubAfter\n\nHub for all commands executed in the children blocks. The only\narguments is a command object that was executed.\nCould return a Command or an array of Commands that should\nbe executed next.\nMost of the time this function will look like a `switch`,\nbut maybe with some additional rules for the cases. Take a look\nto [Command#is](#commandis) function to have a better understanding how you\ncan determine that the command is exactly what you are waiting for.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was executed in some child logic\n                           or in any child of the child and so on down to\n                           the leaf of the tree.\n\n**Examples**\n\n```javascript\nhubAfter(cmd) {\n  if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n    return this.HandlerCommand(123);\n  }\n  if (cmd.is('AnotherChild.SomeAnothercommand')) {\n    return [ this.HandlerCommand(321), this.AnotherHandler ];\n  }\n}\n```\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)** \n\n##### hubBefore\n\nSame as [LogicBase#hubAfter](#logicbasehubafter), but catch commands before\nit will be actually executed, so you can compare prev and next\nmodel state for example.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)** \n\n#### cmd\n\nDecorator that converts a logic method to a command factory.\nThe result function (command factory function) is a function\nthat return a [Command](#command) instnace with the decorated function\nand arguments that you will pass to a command factory function.\n\nYou can use this decorator without arguments or with an options\nargument (object)\n\nCheck [Process#exec](#processexec) to see what the origin function\ncould return to do something. If in short, it can return:\nnothing, command (or factory or array of commands), task,\nmodel update object.\n\n**Parameters**\n\n-   `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** If only this argument passed then it will be considered\n                                   as options object which can customize command behaviour.\n    -   `obj.debounce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be debounced by given amount of\n                                       milliseconds\n    -   `obj.throttle` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be throttled by given amount of\n                                       milliseconds\n    -   `obj.noInitCall` **bool** If true then debounced/throttled execution\n                                       won't start with init command call. By default\n                                       debounced/throttled command will be instantly\n                                       exected and only then wait for a chance to execute\n                                       again. With `noInitCall=true` there is no instant init\n                                       command call.\n    -   `obj.internal` **bool** Make the command invisible for parent [LogicBase#hubBefore](#logicbasehubbefore)\n                                       and [LogicBase#hubAfter](#logicbasehubafter). Use it for commands that shouldn't\n                                       be handled by hubs to increse performance.\n    -   `obj.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** By default name of the command taken from origin function. With this\n                                       option you can override the name with any other value.\n-   `methodName`  \n-   `descr`  \n\n**Examples**\n\n```javascript\nclass RegularLogic {\n  \\@cmd RegularCommand() {\n    // do something\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ debounce: 300 })\n  DebouncedCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 600ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300 })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300, noInitCall: true })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 1 time in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ internal: true })\n  _InternalCommand() {\n    // this command can't be caught in `hubBefore` or `hubAfter`\n    // in parent logics. Use it carefully.\n  }\n}\n```\n\nReturns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory function (if all three arguemnts passed)\n                               or a decorator function with binded options object\n                               (that you pass as a first argument)\n\n#### run\n\nRun given block. It is a short-hand function for running [bind](#bind)\nand then running a Process by [Process#run](#processrun).\nAlso it returns an additional `finished` Promise which is resolved\nwhen all async tasks finished and all handler commands executed.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A block that you wan to run\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Same options as in [bind](#bind) (optional, default `{}`)\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block), finished: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)}** An object\n                 which is almost the same as returned from [bind](#bind), but with\n                 additional `finished` field, which is a Promise that will be resolved\n                 when all blocks will execute all commands and all async tasks will be\n                 finished.\n\n#### mount\n\nMount running block. As third and next arguments you can pass other running\nblocks which will be stopped with the main running block (useful for HMR).\n\n**Parameters**\n\n-   `mounter` **[Mounter](#mounter)** An implementation of [Mounter](#mounter) interface\n-   `runRes` **{proc: [Process](#process), block: [Block](#block), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}** An object that returned\n                     from [run](#run) function.\n-   `otherBlocks` **...any** \n\n**Examples**\n\n```javascript\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nmount(new ReactMounter(), run(MyBlock));\n```\n\nReturns **{view: any, stop: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)}** An object with the result form [Mounter#mount](Mounter#mount)\n                 function (in `view` field) and stop function which destroy the process and\n                 unmount a view using [Mounter#unmount](Mounter#unmount)\n\n#### task\n\nCreates a [TaskMeta](#taskmeta) object that could be returned from\nasync task command. It describes the task that should be executed.\n\nFor more information what the **Task** is and how it should be implemented\ntake a look to [TaskMeta](#taskmeta).\n\n**Parameters**\n\n-   `taskFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that could return a Promise\n\n**Properties**\n\n-   `CANCEL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A symbol that you can use to make a promise \"cancellable\"\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n#### cancel\n\nThis function should be used to cancel async [task](#task) execution.\nAlso it can cancel the debounced/throttled command.\n\n-   In case with task, if task was executing while you call a cancel command,\n    the task will be cancelled (execution stopped). Otherwise nothing will happen.\n-   In case with debounced/throttled command, if the command scheduled to be executed\n    then the schedule timer will be cleared and the command won't be executed.\n    If the command is not scheduled then nothing happens.\n\nTo use it just pass a command or command factory as a first argument\nand return it from some other command.\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Command or command factory that you wan to cancel. Could\n                                    be a command that returns [task](#task) or debounced/throttled\n                                    command\n\n**Examples**\n\n```javascript\nclass SomeLogic {\n  \\@cmd CancelSomethingCommand() {\n    return [\n      cancel(this.TaskCommand),\n      cancel(this.DebounceCommand)\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask);\n  }\n  \\@cmd({ debounce: 300 })\n  DebounceCommand() {\n    // do something\n  }\n}\n```\n\nReturns **[Command](#command)** Returns a new command that will cancel the execution of the command\n                  passed as an argument.\n\n#### child\n\nCreates an object which describes child logic which will be attached\nto some model field. Should be used in [LogicBase#children](#logicbasechildren) to\ndefine a logic that should be instantiated with some arguments passed\nto [LogicBase#config](#logicbaseconfig).\n\n**Parameters**\n\n-   `logicClass` **[LogicBase](#logicbase)** Class that imlements [LogicBase](#logicbase) interface\n-   `args` **...any** \n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  config(amount) {\n    return { meta: { amount } };\n  }\n}\nclass RootLogic {\n  children() {\n    return {\n      modelField: child(ChildLogic, 10)\n      // `config` of `ChildLogic` will be invoked with\n      // `10` as a first argument\n    }\n  }\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object that contains a logic class and an arguments array that\n                 should be used to invoke `config` method of provided logic class.\n\n#### depends\n\nFunction that helps to describe a computed field with external\nmodel dependncies. Should be used in [LogicBase#computed](#logicbasecomputed).\nIt creates an instance of [ComputedField](#computedfield) with dependencies\npassed as arguments.\n\nA compute field with external dependencies is a field that should\nbe updated (re-computed) not only when the own model udpated, but\nalso when depdendency models updated.\n\n**Parameters**\n\n-   `deps` **...deps** A list of models with attached logic\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  // some logic\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  computed() {\n    return {\n      // depends on `childModel`\n      computedField: depends(this.model.childModel).compute(() => {\n        return this.model.a + this.model.childModel.b;\n      }),\n\n      // depends on `shared` model\n      computeWithShared: depends(this.shared).compute(() => {\n        return this.model.b + this.shared.someField;\n      })\n    }\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** \n\n### Extras\n\nOther pieces of MangoJuice\n\n\n#### Process\n\nThe main class of MangoJuice that ties model, logic and view together.\n\nIt works in the following way:\n\n-   You create a model for your app (object) using `createModel` of\n    the root block. The result is a plain object.\n-   Then you need to create an instance of Process and pass logic class\n    in the options object.\n-   Then you `bind` the Process instance to the model object you created on step one.\n    \"To bind Process to a model\" means that in the model will be created a hidden\n    field `__proc` with a reference to the Process instance.\n-   After that you can `run` the Process, which will execute init commands, port.\n\n`bind` and `run` also look at the object returned from [LogicBase#children](#logicbasechildren)\nand create/run Process instances for children models.\n\nMost of the time you do not need to care about all of these and just use\n[run](#run) and [mount](#mount). These small functions do everything described\nabove for you.\n\n**Examples**\n\n```javascript\nimport { Process, logicOf } from 'mangojuice-core';\n\nconst ExampleBlock = {\n  createModel() {\n    return { a: 10 };\n  },\n  Logic: class Example {\n    \\@cmd Increment(amount = 1) {\n      return { a: this.model.a + amount };\n    }\n  }\n};\n\nconst model = ExampleBlock.createModel();\nconst proc = new Process({ logic: ExampleBlock.Logic });\nproc.bind(model);\nproc.run();\nproc.exec(logicOf(model).Increment(23));\n```\n\n##### bind\n\nBind the process instance to a given model, which means that hidden\n`__proc` field will be created in the model with a reference to the\nProcess instance.\n\nAlso bind all children models – go through children definition returned\nby [LogicBase#children](#logicbasechildren), create Process for each child and bind\nit to an appropreat child model object.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to bind to the Process.\n\n##### run\n\nRun the process – run children processes, then run port and\ninit commands defined in config.\nAlso run all model observers created by [observe](#observe)\n\n##### destroy\n\nDestroy the process with unbinding from the model and cleaning\nup all the parts of the process (stop ports, computed fields).\n`__proc` field will be removed from the model object and all\nchildren objects.\n\n**Parameters**\n\n-   `deep` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then all children blocks will be destroyed.\n                             By default, if not provided then considered as true.\n\n##### exec\n\nExec a command in scope of the Process instance.\nIt will use binded model and logic object to run the\ncommand. The command could be function (command factory)\nor object ([Command](#command) instance).\n\nA command origin function could return three types of things:\n\n-   Another [Command](#command)/command factory or an array of commands\n    (an element of the array also could be another array with commands\n    or null/undefined/false). All commands will be execute in provided order.\n-   An instance of [TaskMeta](#taskmeta) (which is usually created by [task](#task)\n    helper function). The returned task will be started and do not block\n    execution of next commands in the stack.\n-   A plain object which is a model update object. The object will be merged\n    with current model.\n\nIf command is undefined or `Process` instance not binded\nto any model it will do nothing.\n\n**Parameters**\n\n-   `cmd` **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory or Command instance\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  \\@cmd BatchCommand() {\n    return [\n      1 > 2 && this.SomeCoomand,\n      this.AnotheCommand(123),\n      2 > 1 && [\n        this.AndSomeOtherCommand,\n        this.FinalCommand()\n      ]\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n  }\n  \\@cmd ModelUpdateCommand() {\n    if (Math.random() > 0.6) {\n      return { field: Date.now() };\n    }\n  }\n}\n```\n\n##### finished\n\nReturns a promise which will be resolved when all async\ntasks and related handlers in the process and all children\nprocesses will be finished.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n#### Command\n\nClass which declares a command that will be executed in the\nfuture by some [Process#exec](#processexec). It contains a function that will be\nexecuted, arguments that should be passed to the function\nand command name.\n\nThe command also keep a context that should be used to execute\na function. Usually this context is some logic instance. You\ncan bind a context to the command using [Command#bind](#commandbind) function.\n\nThe command instance is immutable, so any function that\nmakes some change in the command will produce a new command\ninstead of changing the original one.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** \n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n**Properties**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** An origin function that should be executed\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** A set of arguments that should be used\n                                 to execute the fucntion.\n\n##### exec\n\nExecute a function stored in the command instance. It passes\nstored arguments to the function and call it in stored context.\nReturns the value that was returned form the function.\n\nReturns **any** \n\n##### clone\n\nClone instance of the command\n\nReturns **[Command](#command)** \n\n##### is\n\nCheck is the command equal to some other command or have\na reference to the same origin function. Optionally you can also\ncheck that the command binded to some concrete model (using\nthe second argument).\n\nYou can use many different formats to define the command to check:\n\n-   Just a string, which should be constructed like\n    `Logic Class Name + Function Name`\n-   Command object or command factory that you can get from prorotype\n    of some logic class.\n-   Binded command object or command factory that you can get from\n    concrete model using [logicOf](#logicof) function\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Command object or command factory or command name\n-   `childModel` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Model object that should be binded to the command (optional)\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  \\@cmd SomeCommand() {}\n}\nclass MyLogic {\n  hubAfter(cmd) {\n    if (cmd.is('ChildLogic.SomeCommand')) {\n      // by command name\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand)) {\n      // by command factory\n    }\n    if (cmd.is(logicOf(this.model.child).SomeCommand)) {\n      // by binded to a concrete model command factory (commands\n      // binded for other models will be ignored)\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand, this.model.child)) {\n      // by command factory and concrete child model (commands\n      // binded for other models will be ignored)\n    }\n  }\n}\n```\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the command have same name, or same origin function\n                                and binded to same model (if second argument provided)\n\n##### appendArgs\n\nCreates a new Command instance (clone the command) and append\ngiven list of arguments to the current list of arguments.\nReturns a new Command with new list of arguments.\n\n**Parameters**\n\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of arguments that will be appened\n                               to tne new Command\n\nReturns **[Command](#command)** New command with appended arguments\n\n##### bind\n\nCreates a new Command instance and set given logic instance in it.\nAlso update command name by name of the origin function and name\nof the logic class.\n\n**Parameters**\n\n-   `logic` **[LogicBase](#logicbase)** A logic instance that should be binded to a command\n\nReturns **[Command](#command)** New command binded to given logic instance\n\n#### TaskMeta\n\nClass for declaring an async task. An instance of this object returned\nfrom [taks](taks) function.\n\nA task function is a function that could return a Promise. The resolved value\nwill be passed to a success command handler, the rejected command will be passed\nto a fail command handler.\n\nIf task function do not return a Promise, then the returned value passed to a\nsuccess command, and if the function throw an error then the error passed to\na fail command.\n\nThe task function receive at least one argument – an object with `model`, `shared`\nand `meta`. All the next arguments will be given from a command that returned a task,\nif it is not overrided by [TaskMeta#args](#taskmetaargs)\n\nBy default a task is single-threaded. It means that every call to a task will cancel\npreviously running task if it is running. You can make the task to be multi-threaded\nby [TaskMeta#multithread](#taskmetamultithread), so every call to a task won't cancel the running one.\n\nIn a context of the task function defined special `call` function. This function should\nbe used to invoke sub-tasks. It is important to use `call` to run sub-tasks because\n`call` create a cancellation point of the task – if the task cancelled, then nothing\nwill be executed after currently running `call` sub-task.\n\n`call` returns an object with `result` and `error` fields. If `error` field is not\nempty, then something weird happened in the sub-task. `call` internally have a try/catch,\nso it is not necessary to wrap it with try/catch, just check the `error` field in the\nreturned object and if it is not empty – handle it somehow (throw it, or do any custom\nerror handling)\n\nAlso in a context of the task defined a `notify` function. It is a function that execute\nnotify command if it is defined. The command executed with the same arguments as passed\nto `notify` function. You can use it to incrementally update a model while the long\ntask is executing, to show some progress for the user.\n\n**Parameters**\n\n-   `taskFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `executor` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nasync function SubTask(a, b, c) {\n  this.notify(a + b + c);\n  await this.call(delay, 100);\n  return (a / b * c);\n}\nasync function RootTask({ model }) {\n  const { result, error } = await this.call(SubTask, 1, 0, 3);\n  if (error) {\n    throw new Error('Something weird happened in subtask')\n  }\n  return result + 10;\n}\n```\n\n```javascript\nclass MyLogic {\n  \\@cmd AsyncCommand() {\n    return task(Tasks.RootTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n      .notify(this.NotifyCommand)\n  }\n}\n```\n\n##### notify\n\nSet a notify handler command. This command executed by call of `this.notify`\ninside a task with the same arguments as passed to `this.notify`\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### success\n\nSet a success handler command. Will be executed with a value returned\nfrom the task, or if the task returned a Promise – with resovled value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### fail\n\nSet a fail handler command. Will be executed with error throwed in the task,\nor if the task returned a Promise – with rejected value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### multithread\n\nDefine the task to be \"multi-thread\", so every call\nwill run in parallel with other calls of the same task\nin scope of one process (model).\n\n**Parameters**\n\n-   `val` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### engine\n\nSet task executor function. The executor function should return an object\nthat should have at least two fields: `exec` and `cancel` functions.\n`exec` should return a promise which should be resolved or rejected\nwith an object `{ result, error }`. A `cancel` function should stop\nthe task execution.\n\n**Parameters**\n\n-   `engine` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that returns\n                               `{ exec: Function, cancel: Function }` object\n\nReturns **[TaskMeta](#taskmeta)** \n\n##### args\n\nOverride arguments which will be passed to the task\nstarting from second argument. By default a task will receive\nthe same set of arguments as a task command. If this function invoked,\nthen the task will receive given arguments instead of command arguments.\n\n**Parameters**\n\n-   `args` **...any** \n\nReturns **[TaskMeta](#taskmeta)** \n\n#### DefaultLogger\n\nA class which defins a logger for tracking command execution process.\nThe default implmenetation just defines all possible logger\nmethods (log points) and print errors to the console.\nExtend this class to define your own logging functionality\n(like logging errors with Setnry or Loggly)\n\n**Examples**\n\n```javascript\n// ./index.js\nimport { DefaultLogger, run } from 'mangojuice-core';\nimport MainBlock from './blocks/MainBlock';\n\n// Implement custom logger\nclass SetnryLogger extends DefaultLogger {\n  onCatchError(error, cmd) {\n    Raven.catchException(error);\n  }\n}\n\n// Pass instance of the Logger to `run` options object.\nrun(MainBlock, { logger: new SetnryLogger() });\n```\n\n##### onStartExec\n\nThis method invoked right before anything else - as the first thing\nin [Process#exec](#processexec). Even before any [LogicBase#hubBefore](#logicbasehubbefore).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that just started execution process\n\n##### onStartHandling\n\nInvoked right before command will go through all [LogicBase#hubBefore](#logicbasehubbefore) or [LogicBase#hubAfter](#logicbasehubafter)\nup in the blocks tree. The second argument indicates is it called for [LogicBase#hubBefore](#logicbasehubbefore)\nor for [LogicBase#hubAfter](#logicbasehubafter).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that is going to go through hubs in parent blocks\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command is going through \"after\" hubs, \"before\" otherwise\n\n##### onEndHandling\n\nInvoked when the command went through all hubs and when all sync commands\nreturned from hubs was executed.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that went through all hubs\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command going through \"after\" hubs, \"before\" otherwise\n\n##### onExecuted\n\nInvoked when the command function executed and the return of the function processed –\nall returned commands executed, all async tasks started, the model updated.\nBut it invoked before the command go through \"after\" hubs.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was exectued and the return processed\n-   `result` **any** Returned object from the command's function\n\n##### onEndExec\n\nInvoked right after the command go throught \"after\" hubs. It is the final\nstage of command execution.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was fully executed and handled by parent blocks\n\n##### onCatchError\n\nInvoked if any uncaught error happened while execution of the command\nor anywhere else in the logic, like in [LogicBase#port](#logicbaseport) or in [LogicBase#computed](#logicbasecomputed).\nBy default print the error using `console.error`.\n\n**Parameters**\n\n-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** The error instance\n-   `cmd` **[Command](#command)?** Command that was executing while the error happened\n\n#### ComputedField\n\nClass for declaring computed field with model dependencies.\nGiven array shuold contain models, binded to some\nlogec. They will be passed to compute function in the same order.\nAlso they will be used to track changed and re-compute.\n\nThe class is immutable, so any call to any method will create\na new instance of `ComputedField` and the old one won't be touched.\n\n**Parameters**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** \n\n**Properties**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** An array of models with binded logic\n                                    (attached some [Process](#process))\n-   `computeFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that will be used\n                                    to compute value of the computed field.\n\n##### compute\n\nCreates a new instance of the field and set compute function in it.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that should return a value that\n                             will be used as a value for some computed field in\n                             a model. This function will be invoked with all\n                             dependency models as arguments\n\n**Examples**\n\n```javascript\n// A way to override computed field of some base logic class\n// (thanks to immutability of `ComputedField`)\nclass MyLogic extends SomeOtherLogic {\n  computed() {\n    const oldComputed = super.computed();\n    return {\n      ...oldComputed,\n\n      // Override `oldField` compute function with saved dependencies\n      // and use overrided compute function inside new compute function\n      oldField: oldComputed.compute((...deps) => {\n        return 1 > 0 || oldComputed.oldField.computeFn(...deps);\n      })\n    };\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** New instance of the ComputedField with `computeFn`\n                         set to given function.\n\n#### Mounter\n\nTo use [mount](#mount) function you need to implement a Mounter interface\nwhich should have `mount` and `unmount` functions. It is up to the developer\nhow these functions will be implemented and what view library they will use.\n\nThere is a rule that mounter and view library should follow: view of\na model should be updated only when the model updated and the update\nshouldn't touch views of children models (children views shouldn't be updated\nbecause their models is not changed).\n\nReact perfectly fits for this rule. By implementing `shuoldComponentUpdate`\nyou can control when the component should be updated and when shouldn't. In this\ncase this function should always return `false` and componenent should be\nupdated using `forceUpdate` only when the model is updated (using [observe](#observe)).\n\n**Properties**\n\n-   `mount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that should expect two arguments: model object with\n                                  attached [Process](#process) instance and [Block#View](Block#View).\n                                  It should render the model using given View (somehow).\n-   `unmount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuold unmount mounted view from DOM.\n\n**Examples**\n\n```javascript\n// Minimal react mounter which follow the rules\nclass ViewWrapper extends React.Component {\n  componentDidMount() {\n    const { model } = this.props;\n    this.stopObserver = observe(model, () => this.forceUpdate())\n  }\n  componentWillUnmount() {\n    this.stopObserver();\n  }\n  shouldComponentUpdate() {\n    return false;\n  }\n  render() {\n    const { View, model } = this.props;\n    const Logic = logicOf(model);\n    return <View model={model} Logic={Logic} />\n  }\n}\nclass ReactMounter {\n  mount(model, View) {\n    return React.render(\n      <ViewWrapper View={View} model={model} />,\n      document.querySelector('#container')\n    );\n  }\n  unmount() {\n    return React.unmountComponentAtNode(\n      document.querySelector('#container')\n    );\n  }\n}\n```\n\n#### defineCommand\n\nProvides a way to define a command in the prototype without\nusign a decorator. You should give a prototype of the logic class,\nname of the function which should be converted to a command factory\nand the decorator function (optional).\n\nIf the decorator function is not provided, then [cmd](#cmd) will be used\nby default.\n\n**Parameters**\n\n-   `proto` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Logic class prototype\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Method name that you want to convert to a command factory\n-   `decorator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** Optional decorator function\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n  // throttle 100\n  ThrottledCommand() {\n    return this.SomeCommand();\n  }\n}\n\ndefineCommand(MyLogic.prototype, 'SomeCommand');\ndefineCommand(MyLogic.prototype, 'ThrottledCommand', cmd({ throttle: 100 }));\n```\n\n#### ensureCommand\n\nReturns a [Command](#command) instance or throw an error if given\nargument can't be used to create a [Command](#command) (is not a Command\nor command factory).\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** [Command](#command) instance or command factory. When\n                                     command factory then it will be invoked with\n                                     no arguments to create a command\n\n**Examples**\n\n```javascript\nclass MyLogic() {\n  \\@cmd SomeCommand() {\n    // do something\n  }\n}\n\nconst logic = new MyLogic();\nensureCommand(logic.SomeCommand) // returns Command instance\n// equals to...\nlogic.SomeCommand()\n```\n\nReturns **[Command](#command)** \n\n#### decorateLogic\n\nBy given logic class go through prototypes chain and\ndecorate all cmd functions. Use it if you can't use decorators\nin your project\n\nIt determine that the function should be converted to a command\nfactory (decorated by [cmd](#cmd)) by its name. If the function\nstarts with uppercase letter or underscore+upper-letter, then it\nis considered as a command.\n\n**Parameters**\n\n-   `LogicClass` **[LogicBase](#logicbase)** Logic class that you want to decorate\n-   `deep` **bool** If true then it will go though prototypes chain and\n                        decorate every prototype in the chain.\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n  }\n  _SomePrivateCommand() {\n  }\n  notACommand() {\n    return 123;\n  }\n}\n\n// `SomeCommand` and `_SomePrivateCommand` will be decorated with `cmd`\n// (the prorotype will be changed in-place). `notACommand` won't\n// be decorated.\ndecorateLogic(MyLogic);\n\nconst logic = new MyLogic();\nlogic.SomeCommand() // returns Command instance\nlogic._SomePrivateCommand() // returns Command instance\nlogic.notACommand() // returns 123\n```\n\n#### handleBefore\n\nFunction adds a handler to the [Process](#process) attached to a given\nmodel that will be invoked before every command running for this\nmodel. The handler won't be invoked for commands from children\nmodels of given model.\n\nReturns a function that removes the handler from the Process\n(stop handling)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called before every own command\n\n**Examples**\n\n```javascript\nimport { handleBefore, run, logicOf } from 'mangojuice-core';\n\n// Define root and child logic\nclass ChildLogic {\n  \\@cmd ChildCommand() {}\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  \\@cmd RootCommand() {}\n}\n\n// Run block with empty models\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ childModel: {} })\n});\n\n// Adds a handler to a root model\nhandleBefore(res.model, (cmd) => console.log(cmd));\n\n// Run commands on root and child models\nres.proc.exec(logicOf(res.model).RootCommand);\nres.proc.exec(logicOf(res.model.childModel).ChildCommand);\n\n// In the console will be printed only `RootCommand` command object\n// right before the command will be executed\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### handleAfter\n\nIt is the same as [handleBefore](#handlebefore) but the handler will be invoked\n**after** every own command.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### handle\n\nAlias for [handleAfter](#handleafter)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### logicOf\n\nReturns a Logic instance attached to a given model object. The logic\ninstance stored in attached [Process](#process) instance, so it execute\n[procOf](#procof) for the model to get a [Process](#process) instance and then\nget the logic instance form a Process and return it.\n\nIf Process is not attached to the model, then an Error will be throwed.\nIf the second argument passed then it will also check that the logic\ninstance is instance of some particular class.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `logicClass` **Class?** Optional logic class to check that the logic\n                                  instance is instance of the class\n\nReturns **[LogicBase](#logicbase)** Returns a logic instance\n\n#### observe\n\nA function that adds a handler to the [Process](#process) instance attached\nto a given model, that will be invoked on every command that changed\nthe model. Useful for tracking changes to re-render a view of the model.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process) instance\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be invoked after every command\n                                that changed the model.\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object with options\n    -   `options.batched` **bool** If true then the handler will be invoked only when\n                                        the commands stack is empty and model was changed during\n                                        the stack execution. Useful to reduce amount of not necessary\n                                        view re-renderings.\n\n**Examples**\n\n```javascript\nimport { run, cmd, observe, logicOf } from 'mangojuice-core';\n\nclass MyLogic {\n  \\@cmd MultipleUpdates() {\n    return [\n      this.UpdateOne,\n      this.UpdateTwo\n    ];\n  }\n  \\@cmd UpdateOne() {\n    return { one: this.model.one + 1 };\n  }\n  \\@cmd UpdateTwo() {\n    return { two: this.model.two + 1 };\n  }\n}\n\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ one: 1, two: 1 })\n});\n\nobserve(res.model, () => console.log('not-batched'));\nobserve(res.model, () => console.log('batched'), { batched: true });\n\nres.proc.exec(logicOf(res.model).MultipleUpdates);\n\n// `not-batched` will be printed two times\n// `batched` will be printed only once\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n#### procOf\n\nGet a [Process](#process) instance attached to the given model object.\nInternally it get a `__proc` field from the given model and returns it.\n\nIf given model do not have attached Process, then an Error will be throwed,\nbut only if the second argument is not true, which ignores the error.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `ignoreError` **bool** If true then no error will be throwed if Process\n                               is not attached to the model\n\nReturns **[Process](#process)** An instance of [Process](#process) attached to the model\n\n#### bind\n\nThis function do the following:\n\n-   Creates a model object using [Block#createModel](Block#createModel). It is invoked without\n    arguments.\n-   Create a [Process](#process) instance with logic from [Block#Logic](Block#Logic)\n-   Call [Process#bind](#processbind) with created model\n\nReturns an object with created process instance, model object and given block.\nUsefull when you want to prepare the block to run but you want to run it manually.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A [Block](#block) object\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options object that could change [Process](#process) behaviour (optional, default `{}`)\n    -   `opts.logger` **[DefaultLogger](#defaultlogger)?** A custom logger instance that will be used in the\n                                               Process to track commands execution. By default\n                                               [DefaultLogger](#defaultlogger) will be used.\n    -   `opts.shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object that will be available in any logic in the\n                                          tree as `this.shared`. Could be anything you want, but\n                                          you will get more benifites if you will pass model object\n                                          with attached Process as shared object to be able to make\n                                          computed fields with depending of shared model.\n    -   `opts.args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>?** An array of arguments that will be passed to [LogicBase#config](#logicbaseconfig)\n                                               of the logic.\n    -   `opts.Process` **[Process](#process)?** A class that will be used instead of [Process](#process). By default\n                                          general [Process](#process) is used, but you can customize it for your\n                                          specific needs and pass here. Then every other process in the tree\n                                          will be an instance of this custom [Process](#process) implementation\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block)}** An object with [Process](#process) instance, model object and block that was passed to\n   the function\n\n#### hydrate\n\nThis function replace a `createModel` function in given block\nwith new function that just returns a given model. It is useful\nwhen you have some old model and just want to run everytihing with\nit (for example for server rendering, or hot module replacement)\n\n**Parameters**\n\n-   `block` **[Block](#block)** An original block\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to use\n\n**Examples**\n\n```javascript\n// Hot module replacement example\nimport MyBlock from './MyBlock';\nimport { hydrate, run } from 'mangojuice-core';\n\n// Run initial block\nlet res = run(MyBlock);\n\n// When block changed destroy the old process, hydrate a new\n// block with existing model and run hydrated new block again\nmodule.hot.accept(['./MyBlock'], () => {\n  res.proc.destroy();\n  const newBlock = hydrate(require('./MyBlock'), res.model);\n  res = run(newBlock);\n});\n```\n\nReturns **[Block](#block)** A new block with replaced `createModel` function\n                 which just returns a model that you passed as\n                 second argument.\n\n#### delay\n\nA helper function for delaying execution. Returns a Promise\nwhich will be resolved in given amount of milliseconds. You can\nuse it in [task](#task) to implement some delay in execution, for\ndebouncing for example.\n\n**Parameters**\n\n-   `ms` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** An amount of milliseconds to wait\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that resolved after given amount of milliseconds\n\n## Basic\n\nThe most common APIs that you will work with most of the time\n\n### Block\n\nBlock is a top level component in MangoJuice which consists of three parts:\n\n-   Model factory function `createModel` which should return a plain object.\n    The main requirement for this function is that it should be able to return\n    some model with zero arguments. But it can also accept some arguments\n    as well.\n-   A logic class which implements [LogicBase](#logicbase) interface\n-   A View function which is aimed to render the model created by `createModel`\n\nThe View part is optional and it could have different type depending on\nselected View library to render a model and particular binding library.\n\n**Properties**\n\n-   `Logic` **[LogicBase](#logicbase)** A logic class that should be attached to the model.\n-   `createModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuld return a plain object which\n                                      will be an init model of the block.\n-   `View` **any?** Something that some particular view library can render\n\n**Examples**\n\n```javascript\n// You can define block in short way using an object\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nrun(MyBlock);\n```\n\n```javascript\n// Or you can split it with modules (recommended)\n// ./MyBlock/index.js\nimport Logic from './Logic';\nimport View from './View';\nimport { createModel } from './Model';\nexport default { View, Logic, createModel };\nexport { View, Logic, createModel };\nexport type { Model } from './Model';\n\n// ./MyBlock/Logic.js\nimport type { Model } from './Model';\nimport { LogicBase, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  \\@cmd SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n}\n\n// ./MyBlock/Model.js\nexport type Model = { field: number };\nexport const createModel = () => ({\n  field: 1\n});\n\n// ./MyBlock/View.js\nconst MyBlockView = ({ model }) => (\n  <div>{model.field}</div>\n);\nexport default MyBlockView;\n\n// ./index.js\nimport MyBlock from './MyBlock';\nimport { run } from 'mangojuice-core';\n\nrun(MyBlock);\n```\n\n### LogicBase\n\nBasic class for every logic. It is not necessaty to inherit an actual logic\nclass from it, but for better type-checking it could be really usefull.\n\nLogic class defines:\n\n-   A set of commands that could change an associated model – methods decorated with [cmd](#cmd)\n-   What fields of the model should be associated with which logic class\n    (children blocks) – [LogicBase#children](#logicbasechildren) method\n-   A set of computed model fields – [LogicBase#computed](#logicbasecomputed) method\n-   A set of rules to handle commands from children logic – [LogicBase#hubAfter](#logicbasehubafter)\n    and [LogicBase#hubBefore](#logicbasehubbefore) methods\n-   A logic to handle external events – [LogicBase#port](#logicbaseport) method.\n\nThe logic class defines all the business-logic of some part of your application.\nThe main goal of the logic – change associated model. Check [cmd](#cmd) and [Process#exec](#processexec)\nto have a better understanding how command can be defined and how it is executed.\n\n**Properties**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object which is associated with the\n                               logic class in parent logic.\n-   `meta` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object defined in [LogicBase#config](#logicbaseconfig) method for storing\n                               some internal logic state.\n-   `shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object with some shared state, defined while\n                               run process of the app.\n\n**Examples**\n\n```javascript\n// ./blocks/MyBlock/Logic.js\n// @flow\nimport type { Model } from './Model';\nimport ChildBlock from '../ChildBlock';\nimport { Command, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  children() {\n    return { child: ChildBlock.Logic };\n  }\n  hubAfter(cmd: Command) {\n    if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n      return this.TestCommand(123);\n    }\n  }\n  \\@cmd TestCommand(arg) {\n    return { field: arg + this.model.field };\n  }\n}\n```\n\n#### config\n\nA function that defines init commands and meta object of the\nlogic. Can accept any type and number of arguments. Config\nwill take arguments passed to [child](#child) function (for example\n`child(MyLogic, 1, 2, 3)` defines that the `config` method of\n`MyLogic` will be invoked like `config(1, 2, 3)`)\n\nCould return an object with the fields:\n\n-   `initCommands` which could be an array or a single Command,\n    that will be executed every time when the logic instance created\n    and associated with some model (when [Process#run](#processrun) invoked)\n-   `meta` which could be an object with some internal state of\n    the logic\n\n**Examples**\n\n```javascript\nconfig(props) {\n  return {\n    initCommands: [ this.StartThis, this.SendThat(123) ],\n    meta: { something: props.amount }\n  };\n}\n```\n\n#### children\n\nThis function defines what logic class should be associated\nwith which model field. Should return an object where a key is\na model field name, and a value is a logic class or an object\nthat defines logic with arguments (return from [child](#child) function)\n\n**Examples**\n\n```javascript\nchildren() {\n  return {\n    searchForm: child(SearchForm.Logic, { timeout: 100 }),\n    searchResults: SearchResults.Logic\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n#### computed\n\nShould return an object which defines computed fields of the model.\nA key of the object is a model field, and value is a function or\ncomputed function definition object (return from [depends](#depends) function).\n\nComputed field is lazy, which means that it is computed on the first use\nof the field and the computation result cached until the next update\nof the model.\n\nIf you want to define a computed field which ueses in computation not\nonly fields from the own model, but maybe some values from child model,\nor from shared model, then you will need to use [depends](#depends) function to\ndefine what models used while computation to observe changes of these\nmodels to trigger an update event of the own model (to update views).\n\n**Examples**\n\n```javascript\ncomputed() {\n  return {\n    simple: () => this.model.a + this.model.b,\n    withDeps: depends(this.model.child, this.shared).compute(() => {\n      return this.model.child.a + this.shared.b + this.model.c;\n    })\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n#### port\n\nA function to handle global event, such as browser-level events,\nwebsocket, intervals. The main porpouse of the `port` is to subscribe\nto some global events, execute appropriate commands from the logic\non the events and remove the handlers when the logic was destroyed.\n\n**Parameters**\n\n-   `exec` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** It is a function that execute a passed command\n-   `destroyed` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that will be resolved when the logic destroyed\n\n**Examples**\n\n```javascript\nport(exec, destroyed) {\n  const timer = setInterval(() => {\n    exec(this.SecondPassed);\n  }, 1000);\n  destroyed.then(() => clearInterval(timer));\n}\n```\n\n#### hubAfter\n\nHub for all commands executed in the children blocks. The only\narguments is a command object that was executed.\nCould return a Command or an array of Commands that should\nbe executed next.\nMost of the time this function will look like a `switch`,\nbut maybe with some additional rules for the cases. Take a look\nto [Command#is](#commandis) function to have a better understanding how you\ncan determine that the command is exactly what you are waiting for.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was executed in some child logic\n                           or in any child of the child and so on down to\n                           the leaf of the tree.\n\n**Examples**\n\n```javascript\nhubAfter(cmd) {\n  if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n    return this.HandlerCommand(123);\n  }\n  if (cmd.is('AnotherChild.SomeAnothercommand')) {\n    return [ this.HandlerCommand(321), this.AnotherHandler ];\n  }\n}\n```\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)**\n\n#### hubBefore\n\nSame as [LogicBase#hubAfter](#logicbasehubafter), but catch commands before\nit will be actually executed, so you can compare prev and next\nmodel state for example.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)**\n\n### cmd\n\nDecorator that converts a logic method to a command factory.\nThe result function (command factory function) is a function\nthat return a [Command](#command) instnace with the decorated function\nand arguments that you will pass to a command factory function.\n\nYou can use this decorator without arguments or with an options\nargument (object)\n\nCheck [Process#exec](#processexec) to see what the origin function\ncould return to do something. If in short, it can return:\nnothing, command (or factory or array of commands), task,\nmodel update object.\n\n**Parameters**\n\n-   `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** If only this argument passed then it will be considered\n                                   as options object which can customize command behaviour.\n    -   `obj.debounce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be debounced by given amount of\n                                       milliseconds\n    -   `obj.throttle` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be throttled by given amount of\n                                       milliseconds\n    -   `obj.noInitCall` **bool** If true then debounced/throttled execution\n                                       won't start with init command call. By default\n                                       debounced/throttled command will be instantly\n                                       exected and only then wait for a chance to execute\n                                       again. With `noInitCall=true` there is no instant init\n                                       command call.\n    -   `obj.internal` **bool** Make the command invisible for parent [LogicBase#hubBefore](#logicbasehubbefore)\n                                       and [LogicBase#hubAfter](#logicbasehubafter). Use it for commands that shouldn't\n                                       be handled by hubs to increse performance.\n    -   `obj.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** By default name of the command taken from origin function. With this\n                                       option you can override the name with any other value.\n-   `methodName`\n-   `descr`\n\n**Examples**\n\n```javascript\nclass RegularLogic {\n  \\@cmd RegularCommand() {\n    // do something\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ debounce: 300 })\n  DebouncedCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 600ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300 })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300, noInitCall: true })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 1 time in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ internal: true })\n  _InternalCommand() {\n    // this command can't be caught in `hubBefore` or `hubAfter`\n    // in parent logics. Use it carefully.\n  }\n}\n```\n\nReturns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory function (if all three arguemnts passed)\n                               or a decorator function with binded options object\n                               (that you pass as a first argument)\n\n### run\n\nRun given block. It is a short-hand function for running [bind](#bind)\nand then running a Process by [Process#run](#processrun).\nAlso it returns an additional `finished` Promise which is resolved\nwhen all async tasks finished and all handler commands executed.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A block that you wan to run\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Same options as in [bind](#bind) (optional, default `{}`)\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block), finished: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)}** An object\n                 which is almost the same as returned from [bind](#bind), but with\n                 additional `finished` field, which is a Promise that will be resolved\n                 when all blocks will execute all commands and all async tasks will be\n                 finished.\n\n### mount\n\nMount running block. As third and next arguments you can pass other running\nblocks which will be stopped with the main running block (useful for HMR).\n\n**Parameters**\n\n-   `mounter` **[Mounter](#mounter)** An implementation of [Mounter](#mounter) interface\n-   `runRes` **{proc: [Process](#process), block: [Block](#block), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}** An object that returned\n                     from [run](#run) function.\n-   `otherBlocks` **...any**\n\n**Examples**\n\n```javascript\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nmount(new ReactMounter(), run(MyBlock));\n```\n\nReturns **{view: any, stop: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)}** An object with the result form [Mounter#mount](Mounter#mount)\n                 function (in `view` field) and stop function which destroy the process and\n                 unmount a view using [Mounter#unmount](Mounter#unmount)\n\n### task\n\nCreates a [TaskMeta](#taskmeta) object that could be returned from\nasync task command. It describes the task that should be executed.\n\nFor more information what the **Task** is and how it should be implemented\ntake a look to [TaskMeta](#taskmeta).\n\n**Parameters**\n\n-   `taskFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that could return a Promise\n\n**Properties**\n\n-   `CANCEL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A symbol that you can use to make a promise \"cancellable\"\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n### cancel\n\nThis function should be used to cancel async [task](#task) execution.\nAlso it can cancel the debounced/throttled command.\n\n-   In case with task, if task was executing while you call a cancel command,\n    the task will be cancelled (execution stopped). Otherwise nothing will happen.\n-   In case with debounced/throttled command, if the command scheduled to be executed\n    then the schedule timer will be cleared and the command won't be executed.\n    If the command is not scheduled then nothing happens.\n\nTo use it just pass a command or command factory as a first argument\nand return it from some other command.\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Command or command factory that you wan to cancel. Could\n                                    be a command that returns [task](#task) or debounced/throttled\n                                    command\n\n**Examples**\n\n```javascript\nclass SomeLogic {\n  \\@cmd CancelSomethingCommand() {\n    return [\n      cancel(this.TaskCommand),\n      cancel(this.DebounceCommand)\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask);\n  }\n  \\@cmd({ debounce: 300 })\n  DebounceCommand() {\n    // do something\n  }\n}\n```\n\nReturns **[Command](#command)** Returns a new command that will cancel the execution of the command\n                  passed as an argument.\n\n### child\n\nCreates an object which describes child logic which will be attached\nto some model field. Should be used in [LogicBase#children](#logicbasechildren) to\ndefine a logic that should be instantiated with some arguments passed\nto [LogicBase#config](#logicbaseconfig).\n\n**Parameters**\n\n-   `logicClass` **[LogicBase](#logicbase)** Class that imlements [LogicBase](#logicbase) interface\n-   `args` **...any**\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  config(amount) {\n    return { meta: { amount } };\n  }\n}\nclass RootLogic {\n  children() {\n    return {\n      modelField: child(ChildLogic, 10)\n      // `config` of `ChildLogic` will be invoked with\n      // `10` as a first argument\n    }\n  }\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object that contains a logic class and an arguments array that\n                 should be used to invoke `config` method of provided logic class.\n\n### depends\n\nFunction that helps to describe a computed field with external\nmodel dependncies. Should be used in [LogicBase#computed](#logicbasecomputed).\nIt creates an instance of [ComputedField](#computedfield) with dependencies\npassed as arguments.\n\nA compute field with external dependencies is a field that should\nbe updated (re-computed) not only when the own model udpated, but\nalso when depdendency models updated.\n\n**Parameters**\n\n-   `deps` **...deps** A list of models with attached logic\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  // some logic\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  computed() {\n    return {\n      // depends on `childModel`\n      computedField: depends(this.model.childModel).compute(() => {\n        return this.model.a + this.model.childModel.b;\n      }),\n\n      // depends on `shared` model\n      computeWithShared: depends(this.shared).compute(() => {\n        return this.model.b + this.shared.someField;\n      })\n    }\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)**\n\n## Extras\n\nOther pieces of MangoJuice\n\n### Process\n\nThe main class of MangoJuice that ties model, logic and view together.\n\nIt works in the following way:\n\n-   You create a model for your app (object) using `createModel` of\n    the root block. The result is a plain object.\n-   Then you need to create an instance of Process and pass logic class\n    in the options object.\n-   Then you `bind` the Process instance to the model object you created on step one.\n    \"To bind Process to a model\" means that in the model will be created a hidden\n    field `__proc` with a reference to the Process instance.\n-   After that you can `run` the Process, which will execute init commands, port.\n\n`bind` and `run` also look at the object returned from [LogicBase#children](#logicbasechildren)\nand create/run Process instances for children models.\n\nMost of the time you do not need to care about all of these and just use\n[run](#run) and [mount](#mount). These small functions do everything described\nabove for you.\n\n**Examples**\n\n```javascript\nimport { Process, logicOf } from 'mangojuice-core';\n\nconst ExampleBlock = {\n  createModel() {\n    return { a: 10 };\n  },\n  Logic: class Example {\n    \\@cmd Increment(amount = 1) {\n      return { a: this.model.a + amount };\n    }\n  }\n};\n\nconst model = ExampleBlock.createModel();\nconst proc = new Process({ logic: ExampleBlock.Logic });\nproc.bind(model);\nproc.run();\nproc.exec(logicOf(model).Increment(23));\n```\n\n#### bind\n\nBind the process instance to a given model, which means that hidden\n`__proc` field will be created in the model with a reference to the\nProcess instance.\n\nAlso bind all children models – go through children definition returned\nby [LogicBase#children](#logicbasechildren), create Process for each child and bind\nit to an appropreat child model object.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to bind to the Process.\n\n#### run\n\nRun the process – run children processes, then run port and\ninit commands defined in config.\nAlso run all model observers created by [observe](#observe)\n\n#### destroy\n\nDestroy the process with unbinding from the model and cleaning\nup all the parts of the process (stop ports, computed fields).\n`__proc` field will be removed from the model object and all\nchildren objects.\n\n**Parameters**\n\n-   `deep` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then all children blocks will be destroyed.\n                             By default, if not provided then considered as true.\n\n#### exec\n\nExec a command in scope of the Process instance.\nIt will use binded model and logic object to run the\ncommand. The command could be function (command factory)\nor object ([Command](#command) instance).\n\nA command origin function could return three types of things:\n\n-   Another [Command](#command)/command factory or an array of commands\n    (an element of the array also could be another array with commands\n    or null/undefined/false). All commands will be execute in provided order.\n-   An instance of [TaskMeta](#taskmeta) (which is usually created by [task](#task)\n    helper function). The returned task will be started and do not block\n    execution of next commands in the stack.\n-   A plain object which is a model update object. The object will be merged\n    with current model.\n\nIf command is undefined or `Process` instance not binded\nto any model it will do nothing.\n\n**Parameters**\n\n-   `cmd` **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory or Command instance\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  \\@cmd BatchCommand() {\n    return [\n      1 > 2 && this.SomeCoomand,\n      this.AnotheCommand(123),\n      2 > 1 && [\n        this.AndSomeOtherCommand,\n        this.FinalCommand()\n      ]\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n  }\n  \\@cmd ModelUpdateCommand() {\n    if (Math.random() > 0.6) {\n      return { field: Date.now() };\n    }\n  }\n}\n```\n\n#### finished\n\nReturns a promise which will be resolved when all async\ntasks and related handlers in the process and all children\nprocesses will be finished.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**\n\n### Command\n\nClass which declares a command that will be executed in the\nfuture by some [Process#exec](#processexec). It contains a function that will be\nexecuted, arguments that should be passed to the function\nand command name.\n\nThe command also keep a context that should be used to execute\na function. Usually this context is some logic instance. You\ncan bind a context to the command using [Command#bind](#commandbind) function.\n\nThe command instance is immutable, so any function that\nmakes some change in the command will produce a new command\ninstead of changing the original one.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>**\n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n\n**Properties**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** An origin function that should be executed\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** A set of arguments that should be used\n                                 to execute the fucntion.\n\n#### exec\n\nExecute a function stored in the command instance. It passes\nstored arguments to the function and call it in stored context.\nReturns the value that was returned form the function.\n\nReturns **any**\n\n#### clone\n\nClone instance of the command\n\nReturns **[Command](#command)**\n\n#### is\n\nCheck is the command equal to some other command or have\na reference to the same origin function. Optionally you can also\ncheck that the command binded to some concrete model (using\nthe second argument).\n\nYou can use many different formats to define the command to check:\n\n-   Just a string, which should be constructed like\n    `Logic Class Name + Function Name`\n-   Command object or command factory that you can get from prorotype\n    of some logic class.\n-   Binded command object or command factory that you can get from\n    concrete model using [logicOf](#logicof) function\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Command object or command factory or command name\n-   `childModel` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Model object that should be binded to the command (optional)\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  \\@cmd SomeCommand() {}\n}\nclass MyLogic {\n  hubAfter(cmd) {\n    if (cmd.is('ChildLogic.SomeCommand')) {\n      // by command name\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand)) {\n      // by command factory\n    }\n    if (cmd.is(logicOf(this.model.child).SomeCommand)) {\n      // by binded to a concrete model command factory (commands\n      // binded for other models will be ignored)\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand, this.model.child)) {\n      // by command factory and concrete child model (commands\n      // binded for other models will be ignored)\n    }\n  }\n}\n```\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the command have same name, or same origin function\n                                and binded to same model (if second argument provided)\n\n#### appendArgs\n\nCreates a new Command instance (clone the command) and append\ngiven list of arguments to the current list of arguments.\nReturns a new Command with new list of arguments.\n\n**Parameters**\n\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of arguments that will be appened\n                               to tne new Command\n\nReturns **[Command](#command)** New command with appended arguments\n\n#### bind\n\nCreates a new Command instance and set given logic instance in it.\nAlso update command name by name of the origin function and name\nof the logic class.\n\n**Parameters**\n\n-   `logic` **[LogicBase](#logicbase)** A logic instance that should be binded to a command\n\nReturns **[Command](#command)** New command binded to given logic instance\n\n### TaskMeta\n\nClass for declaring an async task. An instance of this object returned\nfrom [taks](taks) function.\n\nA task function is a function that could return a Promise. The resolved value\nwill be passed to a success command handler, the rejected command will be passed\nto a fail command handler.\n\nIf task function do not return a Promise, then the returned value passed to a\nsuccess command, and if the function throw an error then the error passed to\na fail command.\n\nThe task function receive at least one argument – an object with `model`, `shared`\nand `meta`. All the next arguments will be given from a command that returned a task,\nif it is not overrided by [TaskMeta#args](#taskmetaargs)\n\nBy default a task is single-threaded. It means that every call to a task will cancel\npreviously running task if it is running. You can make the task to be multi-threaded\nby [TaskMeta#multithread](#taskmetamultithread), so every call to a task won't cancel the running one.\n\nIn a context of the task function defined special `call` function. This function should\nbe used to invoke sub-tasks. It is important to use `call` to run sub-tasks because\n`call` create a cancellation point of the task – if the task cancelled, then nothing\nwill be executed after currently running `call` sub-task.\n\n`call` returns an object with `result` and `error` fields. If `error` field is not\nempty, then something weird happened in the sub-task. `call` internally have a try/catch,\nso it is not necessary to wrap it with try/catch, just check the `error` field in the\nreturned object and if it is not empty – handle it somehow (throw it, or do any custom\nerror handling)\n\nAlso in a context of the task defined a `notify` function. It is a function that execute\nnotify command if it is defined. The command executed with the same arguments as passed\nto `notify` function. You can use it to incrementally update a model while the long\ntask is executing, to show some progress for the user.\n\n**Parameters**\n\n-   `taskFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n-   `executor` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n\n**Examples**\n\n```javascript\nasync function SubTask(a, b, c) {\n  this.notify(a + b + c);\n  await this.call(delay, 100);\n  return (a / b * c);\n}\nasync function RootTask({ model }) {\n  const { result, error } = await this.call(SubTask, 1, 0, 3);\n  if (error) {\n    throw new Error('Something weird happened in subtask')\n  }\n  return result + 10;\n}\n```\n\n```javascript\nclass MyLogic {\n  \\@cmd AsyncCommand() {\n    return task(Tasks.RootTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n      .notify(this.NotifyCommand)\n  }\n}\n```\n\n#### notify\n\nSet a notify handler command. This command executed by call of `this.notify`\ninside a task with the same arguments as passed to `this.notify`\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### success\n\nSet a success handler command. Will be executed with a value returned\nfrom the task, or if the task returned a Promise – with resovled value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### fail\n\nSet a fail handler command. Will be executed with error throwed in the task,\nor if the task returned a Promise – with rejected value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### multithread\n\nDefine the task to be \"multi-thread\", so every call\nwill run in parallel with other calls of the same task\nin scope of one process (model).\n\n**Parameters**\n\n-   `val` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### engine\n\nSet task executor function. The executor function should return an object\nthat should have at least two fields: `exec` and `cancel` functions.\n`exec` should return a promise which should be resolved or rejected\nwith an object `{ result, error }`. A `cancel` function should stop\nthe task execution.\n\n**Parameters**\n\n-   `engine` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that returns\n                               `{ exec: Function, cancel: Function }` object\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### args\n\nOverride arguments which will be passed to the task\nstarting from second argument. By default a task will receive\nthe same set of arguments as a task command. If this function invoked,\nthen the task will receive given arguments instead of command arguments.\n\n**Parameters**\n\n-   `args` **...any**\n\nReturns **[TaskMeta](#taskmeta)**\n\n### DefaultLogger\n\nA class which defins a logger for tracking command execution process.\nThe default implmenetation just defines all possible logger\nmethods (log points) and print errors to the console.\nExtend this class to define your own logging functionality\n(like logging errors with Setnry or Loggly)\n\n**Examples**\n\n```javascript\n// ./index.js\nimport { DefaultLogger, run } from 'mangojuice-core';\nimport MainBlock from './blocks/MainBlock';\n\n// Implement custom logger\nclass SetnryLogger extends DefaultLogger {\n  onCatchError(error, cmd) {\n    Raven.catchException(error);\n  }\n}\n\n// Pass instance of the Logger to `run` options object.\nrun(MainBlock, { logger: new SetnryLogger() });\n```\n\n#### onStartExec\n\nThis method invoked right before anything else - as the first thing\nin [Process#exec](#processexec). Even before any [LogicBase#hubBefore](#logicbasehubbefore).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that just started execution process\n\n#### onStartHandling\n\nInvoked right before command will go through all [LogicBase#hubBefore](#logicbasehubbefore) or [LogicBase#hubAfter](#logicbasehubafter)\nup in the blocks tree. The second argument indicates is it called for [LogicBase#hubBefore](#logicbasehubbefore)\nor for [LogicBase#hubAfter](#logicbasehubafter).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that is going to go through hubs in parent blocks\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command is going through \"after\" hubs, \"before\" otherwise\n\n#### onEndHandling\n\nInvoked when the command went through all hubs and when all sync commands\nreturned from hubs was executed.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that went through all hubs\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command going through \"after\" hubs, \"before\" otherwise\n\n#### onExecuted\n\nInvoked when the command function executed and the return of the function processed –\nall returned commands executed, all async tasks started, the model updated.\nBut it invoked before the command go through \"after\" hubs.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was exectued and the return processed\n-   `result` **any** Returned object from the command's function\n\n#### onEndExec\n\nInvoked right after the command go throught \"after\" hubs. It is the final\nstage of command execution.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was fully executed and handled by parent blocks\n\n#### onCatchError\n\nInvoked if any uncaught error happened while execution of the command\nor anywhere else in the logic, like in [LogicBase#port](#logicbaseport) or in [LogicBase#computed](#logicbasecomputed).\nBy default print the error using `console.error`.\n\n**Parameters**\n\n-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** The error instance\n-   `cmd` **[Command](#command)?** Command that was executing while the error happened\n\n### ComputedField\n\nClass for declaring computed field with model dependencies.\nGiven array shuold contain models, binded to some\nlogec. They will be passed to compute function in the same order.\nAlso they will be used to track changed and re-compute.\n\nThe class is immutable, so any call to any method will create\na new instance of `ComputedField` and the old one won't be touched.\n\n**Parameters**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**\n\n**Properties**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** An array of models with binded logic\n                                    (attached some [Process](#process))\n-   `computeFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that will be used\n                                    to compute value of the computed field.\n\n#### compute\n\nCreates a new instance of the field and set compute function in it.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that should return a value that\n                             will be used as a value for some computed field in\n                             a model. This function will be invoked with all\n                             dependency models as arguments\n\n**Examples**\n\n```javascript\n// A way to override computed field of some base logic class\n// (thanks to immutability of `ComputedField`)\nclass MyLogic extends SomeOtherLogic {\n  computed() {\n    const oldComputed = super.computed();\n    return {\n      ...oldComputed,\n\n      // Override `oldField` compute function with saved dependencies\n      // and use overrided compute function inside new compute function\n      oldField: oldComputed.compute((...deps) => {\n        return 1 > 0 || oldComputed.oldField.computeFn(...deps);\n      })\n    };\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** New instance of the ComputedField with `computeFn`\n                         set to given function.\n\n### Mounter\n\nTo use [mount](#mount) function you need to implement a Mounter interface\nwhich should have `mount` and `unmount` functions. It is up to the developer\nhow these functions will be implemented and what view library they will use.\n\nThere is a rule that mounter and view library should follow: view of\na model should be updated only when the model updated and the update\nshouldn't touch views of children models (children views shouldn't be updated\nbecause their models is not changed).\n\nReact perfectly fits for this rule. By implementing `shuoldComponentUpdate`\nyou can control when the component should be updated and when shouldn't. In this\ncase this function should always return `false` and componenent should be\nupdated using `forceUpdate` only when the model is updated (using [observe](#observe)).\n\n**Properties**\n\n-   `mount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that should expect two arguments: model object with\n                                  attached [Process](#process) instance and [Block#View](Block#View).\n                                  It should render the model using given View (somehow).\n-   `unmount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuold unmount mounted view from DOM.\n\n**Examples**\n\n```javascript\n// Minimal react mounter which follow the rules\nclass ViewWrapper extends React.Component {\n  componentDidMount() {\n    const { model } = this.props;\n    this.stopObserver = observe(model, () => this.forceUpdate())\n  }\n  componentWillUnmount() {\n    this.stopObserver();\n  }\n  shouldComponentUpdate() {\n    return false;\n  }\n  render() {\n    const { View, model } = this.props;\n    const Logic = logicOf(model);\n    return <View model={model} Logic={Logic} />\n  }\n}\nclass ReactMounter {\n  mount(model, View) {\n    return React.render(\n      <ViewWrapper View={View} model={model} />,\n      document.querySelector('#container')\n    );\n  }\n  unmount() {\n    return React.unmountComponentAtNode(\n      document.querySelector('#container')\n    );\n  }\n}\n```\n\n### defineCommand\n\nProvides a way to define a command in the prototype without\nusign a decorator. You should give a prototype of the logic class,\nname of the function which should be converted to a command factory\nand the decorator function (optional).\n\nIf the decorator function is not provided, then [cmd](#cmd) will be used\nby default.\n\n**Parameters**\n\n-   `proto` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Logic class prototype\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Method name that you want to convert to a command factory\n-   `decorator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** Optional decorator function\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n  // throttle 100\n  ThrottledCommand() {\n    return this.SomeCommand();\n  }\n}\n\ndefineCommand(MyLogic.prototype, 'SomeCommand');\ndefineCommand(MyLogic.prototype, 'ThrottledCommand', cmd({ throttle: 100 }));\n```\n\n### ensureCommand\n\nReturns a [Command](#command) instance or throw an error if given\nargument can't be used to create a [Command](#command) (is not a Command\nor command factory).\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** [Command](#command) instance or command factory. When\n                                     command factory then it will be invoked with\n                                     no arguments to create a command\n\n**Examples**\n\n```javascript\nclass MyLogic() {\n  \\@cmd SomeCommand() {\n    // do something\n  }\n}\n\nconst logic = new MyLogic();\nensureCommand(logic.SomeCommand) // returns Command instance\n// equals to...\nlogic.SomeCommand()\n```\n\nReturns **[Command](#command)**\n\n### decorateLogic\n\nBy given logic class go through prototypes chain and\ndecorate all cmd functions. Use it if you can't use decorators\nin your project\n\nIt determine that the function should be converted to a command\nfactory (decorated by [cmd](#cmd)) by its name. If the function\nstarts with uppercase letter or underscore+upper-letter, then it\nis considered as a command.\n\n**Parameters**\n\n-   `LogicClass` **[LogicBase](#logicbase)** Logic class that you want to decorate\n-   `deep` **bool** If true then it will go though prototypes chain and\n                        decorate every prototype in the chain.\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n  }\n  _SomePrivateCommand() {\n  }\n  notACommand() {\n    return 123;\n  }\n}\n\n// `SomeCommand` and `_SomePrivateCommand` will be decorated with `cmd`\n// (the prorotype will be changed in-place). `notACommand` won't\n// be decorated.\ndecorateLogic(MyLogic);\n\nconst logic = new MyLogic();\nlogic.SomeCommand() // returns Command instance\nlogic._SomePrivateCommand() // returns Command instance\nlogic.notACommand() // returns 123\n```\n\n### handleBefore\n\nFunction adds a handler to the [Process](#process) attached to a given\nmodel that will be invoked before every command running for this\nmodel. The handler won't be invoked for commands from children\nmodels of given model.\n\nReturns a function that removes the handler from the Process\n(stop handling)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called before every own command\n\n**Examples**\n\n```javascript\nimport { handleBefore, run, logicOf } from 'mangojuice-core';\n\n// Define root and child logic\nclass ChildLogic {\n  \\@cmd ChildCommand() {}\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  \\@cmd RootCommand() {}\n}\n\n// Run block with empty models\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ childModel: {} })\n});\n\n// Adds a handler to a root model\nhandleBefore(res.model, (cmd) => console.log(cmd));\n\n// Run commands on root and child models\nres.proc.exec(logicOf(res.model).RootCommand);\nres.proc.exec(logicOf(res.model.childModel).ChildCommand);\n\n// In the console will be printed only `RootCommand` command object\n// right before the command will be executed\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### handleAfter\n\nIt is the same as [handleBefore](#handlebefore) but the handler will be invoked\n**after** every own command.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### handle\n\nAlias for [handleAfter](#handleafter)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### logicOf\n\nReturns a Logic instance attached to a given model object. The logic\ninstance stored in attached [Process](#process) instance, so it execute\n[procOf](#procof) for the model to get a [Process](#process) instance and then\nget the logic instance form a Process and return it.\n\nIf Process is not attached to the model, then an Error will be throwed.\nIf the second argument passed then it will also check that the logic\ninstance is instance of some particular class.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `logicClass` **Class?** Optional logic class to check that the logic\n                                  instance is instance of the class\n\nReturns **[LogicBase](#logicbase)** Returns a logic instance\n\n### observe\n\nA function that adds a handler to the [Process](#process) instance attached\nto a given model, that will be invoked on every command that changed\nthe model. Useful for tracking changes to re-render a view of the model.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process) instance\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be invoked after every command\n                                that changed the model.\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object with options\n    -   `options.batched` **bool** If true then the handler will be invoked only when\n                                        the commands stack is empty and model was changed during\n                                        the stack execution. Useful to reduce amount of not necessary\n                                        view re-renderings.\n\n**Examples**\n\n```javascript\nimport { run, cmd, observe, logicOf } from 'mangojuice-core';\n\nclass MyLogic {\n  \\@cmd MultipleUpdates() {\n    return [\n      this.UpdateOne,\n      this.UpdateTwo\n    ];\n  }\n  \\@cmd UpdateOne() {\n    return { one: this.model.one + 1 };\n  }\n  \\@cmd UpdateTwo() {\n    return { two: this.model.two + 1 };\n  }\n}\n\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ one: 1, two: 1 })\n});\n\nobserve(res.model, () => console.log('not-batched'));\nobserve(res.model, () => console.log('batched'), { batched: true });\n\nres.proc.exec(logicOf(res.model).MultipleUpdates);\n\n// `not-batched` will be printed two times\n// `batched` will be printed only once\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n\n### procOf\n\nGet a [Process](#process) instance attached to the given model object.\nInternally it get a `__proc` field from the given model and returns it.\n\nIf given model do not have attached Process, then an Error will be throwed,\nbut only if the second argument is not true, which ignores the error.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `ignoreError` **bool** If true then no error will be throwed if Process\n                               is not attached to the model\n\nReturns **[Process](#process)** An instance of [Process](#process) attached to the model\n\n### bind\n\nThis function do the following:\n\n-   Creates a model object using [Block#createModel](Block#createModel). It is invoked without\n    arguments.\n-   Create a [Process](#process) instance with logic from [Block#Logic](Block#Logic)\n-   Call [Process#bind](#processbind) with created model\n\nReturns an object with created process instance, model object and given block.\nUsefull when you want to prepare the block to run but you want to run it manually.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A [Block](#block) object\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options object that could change [Process](#process) behaviour (optional, default `{}`)\n    -   `opts.logger` **[DefaultLogger](#defaultlogger)?** A custom logger instance that will be used in the\n                                               Process to track commands execution. By default\n                                               [DefaultLogger](#defaultlogger) will be used.\n    -   `opts.shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object that will be available in any logic in the\n                                          tree as `this.shared`. Could be anything you want, but\n                                          you will get more benifites if you will pass model object\n                                          with attached Process as shared object to be able to make\n                                          computed fields with depending of shared model.\n    -   `opts.args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>?** An array of arguments that will be passed to [LogicBase#config](#logicbaseconfig)\n                                               of the logic.\n    -   `opts.Process` **[Process](#process)?** A class that will be used instead of [Process](#process). By default\n                                          general [Process](#process) is used, but you can customize it for your\n                                          specific needs and pass here. Then every other process in the tree\n                                          will be an instance of this custom [Process](#process) implementation\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block)}** An object with [Process](#process) instance, model object and block that was passed to\n   the function\n\n### hydrate\n\nThis function replace a `createModel` function in given block\nwith new function that just returns a given model. It is useful\nwhen you have some old model and just want to run everytihing with\nit (for example for server rendering, or hot module replacement)\n\n**Parameters**\n\n-   `block` **[Block](#block)** An original block\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to use\n\n**Examples**\n\n```javascript\n// Hot module replacement example\nimport MyBlock from './MyBlock';\nimport { hydrate, run } from 'mangojuice-core';\n\n// Run initial block\nlet res = run(MyBlock);\n\n// When block changed destroy the old process, hydrate a new\n// block with existing model and run hydrated new block again\nmodule.hot.accept(['./MyBlock'], () => {\n  res.proc.destroy();\n  const newBlock = hydrate(require('./MyBlock'), res.model);\n  res = run(newBlock);\n});\n```\n\nReturns **[Block](#block)** A new block with replaced `createModel` function\n                 which just returns a model that you passed as\n                 second argument.\n\n### delay\n\nA helper function for delaying execution. Returns a Promise\nwhich will be resolved in given amount of milliseconds. You can\nuse it in [task](#task) to implement some delay in execution, for\ndebouncing for example.\n\n**Parameters**\n\n-   `ms` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** An amount of milliseconds to wait\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that resolved after given amount of milliseconds\n","readmeFilename":"README.md","_id":"mangojuice-core@2.0.0-y.0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-SJN7Lix1NG61dESq2tnChsEETJ93HdCBxHv6YzgSptmmgEH4ExHhd1uK+Jc/8jNNudPWeCejf2VQORkIF+MNmw==","shasum":"7df88ac714c1ab9dd88e818d7ba5816b2783905c","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-2.0.0-y.0.tgz","fileCount":34,"unpackedSize":1873423,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDnWkwy5wayhhqfbsWgkyx2s//PsTEf3kjXCP00uMawIgIhANMkiuP9oVwU04Juv4O9l6mzzlm+8gojntVSpFR/fxnv"}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core_2.0.0-y.0_1519484162628_0.8984230621844103"},"_hasShrinkwrap":false},"2.0.0-2":{"name":"mangojuice-core","version":"2.0.0-2","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"readme":"# MangoJuice Core\n\n## Reference\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n#### Table of Contents\n\n-   [Basic](#basic)\n    -   [Block](#block)\n    -   [LogicBase](#logicbase)\n        -   [config](#config)\n        -   [children](#children)\n        -   [computed](#computed)\n        -   [port](#port)\n        -   [hubAfter](#hubafter)\n        -   [hubBefore](#hubbefore)\n    -   [cmd](#cmd)\n    -   [run](#run)\n    -   [mount](#mount)\n    -   [task](#task)\n    -   [cancel](#cancel)\n    -   [child](#child)\n    -   [depends](#depends)\n-   [Extras](#extras)\n    -   [Process](#process)\n        -   [bind](#bind)\n        -   [run](#run-1)\n        -   [destroy](#destroy)\n        -   [exec](#exec)\n        -   [finished](#finished)\n    -   [Command](#command)\n        -   [exec](#exec-1)\n        -   [clone](#clone)\n        -   [is](#is)\n        -   [appendArgs](#appendargs)\n        -   [bind](#bind-1)\n    -   [TaskMeta](#taskmeta)\n        -   [notify](#notify)\n        -   [success](#success)\n        -   [fail](#fail)\n        -   [multithread](#multithread)\n        -   [engine](#engine)\n        -   [args](#args)\n    -   [DefaultLogger](#defaultlogger)\n        -   [onStartExec](#onstartexec)\n        -   [onStartHandling](#onstarthandling)\n        -   [onEndHandling](#onendhandling)\n        -   [onExecuted](#onexecuted)\n        -   [onEndExec](#onendexec)\n        -   [onCatchError](#oncatcherror)\n    -   [ComputedField](#computedfield)\n        -   [compute](#compute)\n    -   [Mounter](#mounter)\n    -   [defineCommand](#definecommand)\n    -   [ensureCommand](#ensurecommand)\n    -   [decorateLogic](#decoratelogic)\n    -   [handleBefore](#handlebefore)\n    -   [handleAfter](#handleafter)\n    -   [handle](#handle)\n    -   [logicOf](#logicof)\n    -   [observe](#observe)\n    -   [procOf](#procof)\n    -   [bind](#bind-2)\n    -   [hydrate](#hydrate)\n    -   [delay](#delay)\n\n### Basic\n\nThe most common APIs that you will work with most of the time\n\n\n#### Block\n\nBlock is a top level component in MangoJuice which consists of three parts:\n\n-   Model factory function `createModel` which should return a plain object.\n    The main requirement for this function is that it should be able to return\n    some model with zero arguments. But it can also accept some arguments\n    as well.\n-   A logic class which implements [LogicBase](#logicbase) interface\n-   A View function which is aimed to render the model created by `createModel`\n\nThe View part is optional and it could have different type depending on\nselected View library to render a model and particular binding library.\n\n**Properties**\n\n-   `Logic` **[LogicBase](#logicbase)** A logic class that should be attached to the model.\n-   `createModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuld return a plain object which\n                                      will be an init model of the block.\n-   `View` **any?** Something that some particular view library can render\n\n**Examples**\n\n```javascript\n// You can define block in short way using an object\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nrun(MyBlock);\n```\n\n```javascript\n// Or you can split it with modules (recommended)\n// ./MyBlock/index.js\nimport Logic from './Logic';\nimport View from './View';\nimport { createModel } from './Model';\nexport default { View, Logic, createModel };\nexport { View, Logic, createModel };\nexport type { Model } from './Model';\n\n// ./MyBlock/Logic.js\nimport type { Model } from './Model';\nimport { LogicBase, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  \\@cmd SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n}\n\n// ./MyBlock/Model.js\nexport type Model = { field: number };\nexport const createModel = () => ({\n  field: 1\n});\n\n// ./MyBlock/View.js\nconst MyBlockView = ({ model }) => (\n  <div>{model.field}</div>\n);\nexport default MyBlockView;\n\n// ./index.js\nimport MyBlock from './MyBlock';\nimport { run } from 'mangojuice-core';\n\nrun(MyBlock);\n```\n\n#### LogicBase\n\nBasic class for every logic. It is not necessaty to inherit an actual logic\nclass from it, but for better type-checking it could be really usefull.\n\nLogic class defines:\n\n-   A set of commands that could change an associated model – methods decorated with [cmd](#cmd)\n-   What fields of the model should be associated with which logic class\n    (children blocks) – [LogicBase#children](#logicbasechildren) method\n-   A set of computed model fields – [LogicBase#computed](#logicbasecomputed) method\n-   A set of rules to handle commands from children logic – [LogicBase#hubAfter](#logicbasehubafter)\n    and [LogicBase#hubBefore](#logicbasehubbefore) methods\n-   A logic to handle external events – [LogicBase#port](#logicbaseport) method.\n\nThe logic class defines all the business-logic of some part of your application.\nThe main goal of the logic – change associated model. Check [cmd](#cmd) and [Process#exec](#processexec)\nto have a better understanding how command can be defined and how it is executed.\n\n**Properties**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object which is associated with the\n                               logic class in parent logic.\n-   `meta` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object defined in [LogicBase#config](#logicbaseconfig) method for storing\n                               some internal logic state.\n-   `shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object with some shared state, defined while\n                               run process of the app.\n\n**Examples**\n\n```javascript\n// ./blocks/MyBlock/Logic.js\n// @flow\nimport type { Model } from './Model';\nimport ChildBlock from '../ChildBlock';\nimport { Command, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  children() {\n    return { child: ChildBlock.Logic };\n  }\n  hubAfter(cmd: Command) {\n    if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n      return this.TestCommand(123);\n    }\n  }\n  \\@cmd TestCommand(arg) {\n    return { field: arg + this.model.field };\n  }\n}\n```\n\n##### config\n\nA function that defines init commands and meta object of the\nlogic. Can accept any type and number of arguments. Config\nwill take arguments passed to [child](#child) function (for example\n`child(MyLogic, 1, 2, 3)` defines that the `config` method of\n`MyLogic` will be invoked like `config(1, 2, 3)`)\n\nCould return an object with the fields:\n\n-   `initCommands` which could be an array or a single Command,\n    that will be executed every time when the logic instance created\n    and associated with some model (when [Process#run](#processrun) invoked)\n-   `meta` which could be an object with some internal state of\n    the logic\n\n**Examples**\n\n```javascript\nconfig(props) {\n  return {\n    initCommands: [ this.StartThis, this.SendThat(123) ],\n    meta: { something: props.amount }\n  };\n}\n```\n\n##### children\n\nThis function defines what logic class should be associated\nwith which model field. Should return an object where a key is\na model field name, and a value is a logic class or an object\nthat defines logic with arguments (return from [child](#child) function)\n\n**Examples**\n\n```javascript\nchildren() {\n  return {\n    searchForm: child(SearchForm.Logic, { timeout: 100 }),\n    searchResults: SearchResults.Logic\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n##### computed\n\nShould return an object which defines computed fields of the model.\nA key of the object is a model field, and value is a function or\ncomputed function definition object (return from [depends](#depends) function).\n\nComputed field is lazy, which means that it is computed on the first use\nof the field and the computation result cached until the next update\nof the model.\n\nIf you want to define a computed field which ueses in computation not\nonly fields from the own model, but maybe some values from child model,\nor from shared model, then you will need to use [depends](#depends) function to\ndefine what models used while computation to observe changes of these\nmodels to trigger an update event of the own model (to update views).\n\n**Examples**\n\n```javascript\ncomputed() {\n  return {\n    simple: () => this.model.a + this.model.b,\n    withDeps: depends(this.model.child, this.shared).compute(() => {\n      return this.model.child.a + this.shared.b + this.model.c;\n    })\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n##### port\n\nA function to handle global event, such as browser-level events,\nwebsocket, intervals. The main porpouse of the `port` is to subscribe\nto some global events, execute appropriate commands from the logic\non the events and remove the handlers when the logic was destroyed.\n\n**Parameters**\n\n-   `exec` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** It is a function that execute a passed command\n-   `destroyed` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that will be resolved when the logic destroyed\n\n**Examples**\n\n```javascript\nport(exec, destroyed) {\n  const timer = setInterval(() => {\n    exec(this.SecondPassed);\n  }, 1000);\n  destroyed.then(() => clearInterval(timer));\n}\n```\n\n##### hubAfter\n\nHub for all commands executed in the children blocks. The only\narguments is a command object that was executed.\nCould return a Command or an array of Commands that should\nbe executed next.\nMost of the time this function will look like a `switch`,\nbut maybe with some additional rules for the cases. Take a look\nto [Command#is](#commandis) function to have a better understanding how you\ncan determine that the command is exactly what you are waiting for.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was executed in some child logic\n                           or in any child of the child and so on down to\n                           the leaf of the tree.\n\n**Examples**\n\n```javascript\nhubAfter(cmd) {\n  if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n    return this.HandlerCommand(123);\n  }\n  if (cmd.is('AnotherChild.SomeAnothercommand')) {\n    return [ this.HandlerCommand(321), this.AnotherHandler ];\n  }\n}\n```\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)** \n\n##### hubBefore\n\nSame as [LogicBase#hubAfter](#logicbasehubafter), but catch commands before\nit will be actually executed, so you can compare prev and next\nmodel state for example.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)** \n\n#### cmd\n\nDecorator that converts a logic method to a command factory.\nThe result function (command factory function) is a function\nthat return a [Command](#command) instnace with the decorated function\nand arguments that you will pass to a command factory function.\n\nYou can use this decorator without arguments or with an options\nargument (object)\n\nCheck [Process#exec](#processexec) to see what the origin function\ncould return to do something. If in short, it can return:\nnothing, command (or factory or array of commands), task,\nmodel update object.\n\n**Parameters**\n\n-   `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** If only this argument passed then it will be considered\n                                   as options object which can customize command behaviour.\n    -   `obj.debounce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be debounced by given amount of\n                                       milliseconds\n    -   `obj.throttle` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be throttled by given amount of\n                                       milliseconds\n    -   `obj.noInitCall` **bool** If true then debounced/throttled execution\n                                       won't start with init command call. By default\n                                       debounced/throttled command will be instantly\n                                       exected and only then wait for a chance to execute\n                                       again. With `noInitCall=true` there is no instant init\n                                       command call.\n    -   `obj.internal` **bool** Make the command invisible for parent [LogicBase#hubBefore](#logicbasehubbefore)\n                                       and [LogicBase#hubAfter](#logicbasehubafter). Use it for commands that shouldn't\n                                       be handled by hubs to increse performance.\n    -   `obj.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** By default name of the command taken from origin function. With this\n                                       option you can override the name with any other value.\n-   `methodName`  \n-   `descr`  \n\n**Examples**\n\n```javascript\nclass RegularLogic {\n  \\@cmd RegularCommand() {\n    // do something\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ debounce: 300 })\n  DebouncedCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 600ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300 })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300, noInitCall: true })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 1 time in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ internal: true })\n  _InternalCommand() {\n    // this command can't be caught in `hubBefore` or `hubAfter`\n    // in parent logics. Use it carefully.\n  }\n}\n```\n\nReturns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory function (if all three arguemnts passed)\n                               or a decorator function with binded options object\n                               (that you pass as a first argument)\n\n#### run\n\nRun given block. It is a short-hand function for running [bind](#bind)\nand then running a Process by [Process#run](#processrun).\nAlso it returns an additional `finished` Promise which is resolved\nwhen all async tasks finished and all handler commands executed.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A block that you wan to run\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Same options as in [bind](#bind) (optional, default `{}`)\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block), finished: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)}** An object\n                 which is almost the same as returned from [bind](#bind), but with\n                 additional `finished` field, which is a Promise that will be resolved\n                 when all blocks will execute all commands and all async tasks will be\n                 finished.\n\n#### mount\n\nMount running block. As third and next arguments you can pass other running\nblocks which will be stopped with the main running block (useful for HMR).\n\n**Parameters**\n\n-   `mounter` **[Mounter](#mounter)** An implementation of [Mounter](#mounter) interface\n-   `runRes` **{proc: [Process](#process), block: [Block](#block), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}** An object that returned\n                     from [run](#run) function.\n-   `otherBlocks` **...any** \n\n**Examples**\n\n```javascript\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nmount(new ReactMounter(), run(MyBlock));\n```\n\nReturns **{view: any, stop: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)}** An object with the result form [Mounter#mount](Mounter#mount)\n                 function (in `view` field) and stop function which destroy the process and\n                 unmount a view using [Mounter#unmount](Mounter#unmount)\n\n#### task\n\nCreates a [TaskMeta](#taskmeta) object that could be returned from\nasync task command. It describes the task that should be executed.\n\nFor more information what the **Task** is and how it should be implemented\ntake a look to [TaskMeta](#taskmeta).\n\n**Parameters**\n\n-   `taskFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that could return a Promise\n\n**Properties**\n\n-   `CANCEL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A symbol that you can use to make a promise \"cancellable\"\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n#### cancel\n\nThis function should be used to cancel async [task](#task) execution.\nAlso it can cancel the debounced/throttled command.\n\n-   In case with task, if task was executing while you call a cancel command,\n    the task will be cancelled (execution stopped). Otherwise nothing will happen.\n-   In case with debounced/throttled command, if the command scheduled to be executed\n    then the schedule timer will be cleared and the command won't be executed.\n    If the command is not scheduled then nothing happens.\n\nTo use it just pass a command or command factory as a first argument\nand return it from some other command.\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Command or command factory that you wan to cancel. Could\n                                    be a command that returns [task](#task) or debounced/throttled\n                                    command\n\n**Examples**\n\n```javascript\nclass SomeLogic {\n  \\@cmd CancelSomethingCommand() {\n    return [\n      cancel(this.TaskCommand),\n      cancel(this.DebounceCommand)\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask);\n  }\n  \\@cmd({ debounce: 300 })\n  DebounceCommand() {\n    // do something\n  }\n}\n```\n\nReturns **[Command](#command)** Returns a new command that will cancel the execution of the command\n                  passed as an argument.\n\n#### child\n\nCreates an object which describes child logic which will be attached\nto some model field. Should be used in [LogicBase#children](#logicbasechildren) to\ndefine a logic that should be instantiated with some arguments passed\nto [LogicBase#config](#logicbaseconfig).\n\n**Parameters**\n\n-   `logicClass` **[LogicBase](#logicbase)** Class that imlements [LogicBase](#logicbase) interface\n-   `args` **...any** \n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  config(amount) {\n    return { meta: { amount } };\n  }\n}\nclass RootLogic {\n  children() {\n    return {\n      modelField: child(ChildLogic, 10)\n      // `config` of `ChildLogic` will be invoked with\n      // `10` as a first argument\n    }\n  }\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object that contains a logic class and an arguments array that\n                 should be used to invoke `config` method of provided logic class.\n\n#### depends\n\nFunction that helps to describe a computed field with external\nmodel dependncies. Should be used in [LogicBase#computed](#logicbasecomputed).\nIt creates an instance of [ComputedField](#computedfield) with dependencies\npassed as arguments.\n\nA compute field with external dependencies is a field that should\nbe updated (re-computed) not only when the own model udpated, but\nalso when depdendency models updated.\n\n**Parameters**\n\n-   `deps` **...deps** A list of models with attached logic\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  // some logic\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  computed() {\n    return {\n      // depends on `childModel`\n      computedField: depends(this.model.childModel).compute(() => {\n        return this.model.a + this.model.childModel.b;\n      }),\n\n      // depends on `shared` model\n      computeWithShared: depends(this.shared).compute(() => {\n        return this.model.b + this.shared.someField;\n      })\n    }\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** \n\n### Extras\n\nOther pieces of MangoJuice\n\n\n#### Process\n\nThe main class of MangoJuice that ties model, logic and view together.\n\nIt works in the following way:\n\n-   You create a model for your app (object) using `createModel` of\n    the root block. The result is a plain object.\n-   Then you need to create an instance of Process and pass logic class\n    in the options object.\n-   Then you `bind` the Process instance to the model object you created on step one.\n    \"To bind Process to a model\" means that in the model will be created a hidden\n    field `__proc` with a reference to the Process instance.\n-   After that you can `run` the Process, which will execute init commands, port.\n\n`bind` and `run` also look at the object returned from [LogicBase#children](#logicbasechildren)\nand create/run Process instances for children models.\n\nMost of the time you do not need to care about all of these and just use\n[run](#run) and [mount](#mount). These small functions do everything described\nabove for you.\n\n**Examples**\n\n```javascript\nimport { Process, logicOf } from 'mangojuice-core';\n\nconst ExampleBlock = {\n  createModel() {\n    return { a: 10 };\n  },\n  Logic: class Example {\n    \\@cmd Increment(amount = 1) {\n      return { a: this.model.a + amount };\n    }\n  }\n};\n\nconst model = ExampleBlock.createModel();\nconst proc = new Process({ logic: ExampleBlock.Logic });\nproc.bind(model);\nproc.run();\nproc.exec(logicOf(model).Increment(23));\n```\n\n##### bind\n\nBind the process instance to a given model, which means that hidden\n`__proc` field will be created in the model with a reference to the\nProcess instance.\n\nAlso bind all children models – go through children definition returned\nby [LogicBase#children](#logicbasechildren), create Process for each child and bind\nit to an appropreat child model object.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to bind to the Process.\n\n##### run\n\nRun the process – run children processes, then run port and\ninit commands defined in config.\nAlso run all model observers created by [observe](#observe)\n\n##### destroy\n\nDestroy the process with unbinding from the model and cleaning\nup all the parts of the process (stop ports, computed fields).\n`__proc` field will be removed from the model object and all\nchildren objects.\n\n**Parameters**\n\n-   `deep` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then all children blocks will be destroyed.\n                             By default, if not provided then considered as true.\n\n##### exec\n\nExec a command in scope of the Process instance.\nIt will use binded model and logic object to run the\ncommand. The command could be function (command factory)\nor object ([Command](#command) instance).\n\nA command origin function could return three types of things:\n\n-   Another [Command](#command)/command factory or an array of commands\n    (an element of the array also could be another array with commands\n    or null/undefined/false). All commands will be execute in provided order.\n-   An instance of [TaskMeta](#taskmeta) (which is usually created by [task](#task)\n    helper function). The returned task will be started and do not block\n    execution of next commands in the stack.\n-   A plain object which is a model update object. The object will be merged\n    with current model.\n\nIf command is undefined or `Process` instance not binded\nto any model it will do nothing.\n\n**Parameters**\n\n-   `cmd` **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory or Command instance\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  \\@cmd BatchCommand() {\n    return [\n      1 > 2 && this.SomeCoomand,\n      this.AnotheCommand(123),\n      2 > 1 && [\n        this.AndSomeOtherCommand,\n        this.FinalCommand()\n      ]\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n  }\n  \\@cmd ModelUpdateCommand() {\n    if (Math.random() > 0.6) {\n      return { field: Date.now() };\n    }\n  }\n}\n```\n\n##### finished\n\nReturns a promise which will be resolved when all async\ntasks and related handlers in the process and all children\nprocesses will be finished.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n#### Command\n\nClass which declares a command that will be executed in the\nfuture by some [Process#exec](#processexec). It contains a function that will be\nexecuted, arguments that should be passed to the function\nand command name.\n\nThe command also keep a context that should be used to execute\na function. Usually this context is some logic instance. You\ncan bind a context to the command using [Command#bind](#commandbind) function.\n\nThe command instance is immutable, so any function that\nmakes some change in the command will produce a new command\ninstead of changing the original one.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** \n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n**Properties**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** An origin function that should be executed\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** A set of arguments that should be used\n                                 to execute the fucntion.\n\n##### exec\n\nExecute a function stored in the command instance. It passes\nstored arguments to the function and call it in stored context.\nReturns the value that was returned form the function.\n\nReturns **any** \n\n##### clone\n\nClone instance of the command\n\nReturns **[Command](#command)** \n\n##### is\n\nCheck is the command equal to some other command or have\na reference to the same origin function. Optionally you can also\ncheck that the command binded to some concrete model (using\nthe second argument).\n\nYou can use many different formats to define the command to check:\n\n-   Just a string, which should be constructed like\n    `Logic Class Name + Function Name`\n-   Command object or command factory that you can get from prorotype\n    of some logic class.\n-   Binded command object or command factory that you can get from\n    concrete model using [logicOf](#logicof) function\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Command object or command factory or command name\n-   `childModel` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Model object that should be binded to the command (optional)\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  \\@cmd SomeCommand() {}\n}\nclass MyLogic {\n  hubAfter(cmd) {\n    if (cmd.is('ChildLogic.SomeCommand')) {\n      // by command name\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand)) {\n      // by command factory\n    }\n    if (cmd.is(logicOf(this.model.child).SomeCommand)) {\n      // by binded to a concrete model command factory (commands\n      // binded for other models will be ignored)\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand, this.model.child)) {\n      // by command factory and concrete child model (commands\n      // binded for other models will be ignored)\n    }\n  }\n}\n```\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the command have same name, or same origin function\n                                and binded to same model (if second argument provided)\n\n##### appendArgs\n\nCreates a new Command instance (clone the command) and append\ngiven list of arguments to the current list of arguments.\nReturns a new Command with new list of arguments.\n\n**Parameters**\n\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of arguments that will be appened\n                               to tne new Command\n\nReturns **[Command](#command)** New command with appended arguments\n\n##### bind\n\nCreates a new Command instance and set given logic instance in it.\nAlso update command name by name of the origin function and name\nof the logic class.\n\n**Parameters**\n\n-   `logic` **[LogicBase](#logicbase)** A logic instance that should be binded to a command\n\nReturns **[Command](#command)** New command binded to given logic instance\n\n#### TaskMeta\n\nClass for declaring an async task. An instance of this object returned\nfrom [taks](taks) function.\n\nA task function is a function that could return a Promise. The resolved value\nwill be passed to a success command handler, the rejected command will be passed\nto a fail command handler.\n\nIf task function do not return a Promise, then the returned value passed to a\nsuccess command, and if the function throw an error then the error passed to\na fail command.\n\nThe task function receive at least one argument – an object with `model`, `shared`\nand `meta`. All the next arguments will be given from a command that returned a task,\nif it is not overrided by [TaskMeta#args](#taskmetaargs)\n\nBy default a task is single-threaded. It means that every call to a task will cancel\npreviously running task if it is running. You can make the task to be multi-threaded\nby [TaskMeta#multithread](#taskmetamultithread), so every call to a task won't cancel the running one.\n\nIn a context of the task function defined special `call` function. This function should\nbe used to invoke sub-tasks. It is important to use `call` to run sub-tasks because\n`call` create a cancellation point of the task – if the task cancelled, then nothing\nwill be executed after currently running `call` sub-task.\n\n`call` returns an object with `result` and `error` fields. If `error` field is not\nempty, then something weird happened in the sub-task. `call` internally have a try/catch,\nso it is not necessary to wrap it with try/catch, just check the `error` field in the\nreturned object and if it is not empty – handle it somehow (throw it, or do any custom\nerror handling)\n\nAlso in a context of the task defined a `notify` function. It is a function that execute\nnotify command if it is defined. The command executed with the same arguments as passed\nto `notify` function. You can use it to incrementally update a model while the long\ntask is executing, to show some progress for the user.\n\n**Parameters**\n\n-   `taskFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `executor` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nasync function SubTask(a, b, c) {\n  this.notify(a + b + c);\n  await this.call(delay, 100);\n  return (a / b * c);\n}\nasync function RootTask({ model }) {\n  const { result, error } = await this.call(SubTask, 1, 0, 3);\n  if (error) {\n    throw new Error('Something weird happened in subtask')\n  }\n  return result + 10;\n}\n```\n\n```javascript\nclass MyLogic {\n  \\@cmd AsyncCommand() {\n    return task(Tasks.RootTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n      .notify(this.NotifyCommand)\n  }\n}\n```\n\n##### notify\n\nSet a notify handler command. This command executed by call of `this.notify`\ninside a task with the same arguments as passed to `this.notify`\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### success\n\nSet a success handler command. Will be executed with a value returned\nfrom the task, or if the task returned a Promise – with resovled value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### fail\n\nSet a fail handler command. Will be executed with error throwed in the task,\nor if the task returned a Promise – with rejected value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### multithread\n\nDefine the task to be \"multi-thread\", so every call\nwill run in parallel with other calls of the same task\nin scope of one process (model).\n\n**Parameters**\n\n-   `val` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### engine\n\nSet task executor function. The executor function should return an object\nthat should have at least two fields: `exec` and `cancel` functions.\n`exec` should return a promise which should be resolved or rejected\nwith an object `{ result, error }`. A `cancel` function should stop\nthe task execution.\n\n**Parameters**\n\n-   `engine` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that returns\n                               `{ exec: Function, cancel: Function }` object\n\nReturns **[TaskMeta](#taskmeta)** \n\n##### args\n\nOverride arguments which will be passed to the task\nstarting from second argument. By default a task will receive\nthe same set of arguments as a task command. If this function invoked,\nthen the task will receive given arguments instead of command arguments.\n\n**Parameters**\n\n-   `args` **...any** \n\nReturns **[TaskMeta](#taskmeta)** \n\n#### DefaultLogger\n\nA class which defins a logger for tracking command execution process.\nThe default implmenetation just defines all possible logger\nmethods (log points) and print errors to the console.\nExtend this class to define your own logging functionality\n(like logging errors with Setnry or Loggly)\n\n**Examples**\n\n```javascript\n// ./index.js\nimport { DefaultLogger, run } from 'mangojuice-core';\nimport MainBlock from './blocks/MainBlock';\n\n// Implement custom logger\nclass SetnryLogger extends DefaultLogger {\n  onCatchError(error, cmd) {\n    Raven.catchException(error);\n  }\n}\n\n// Pass instance of the Logger to `run` options object.\nrun(MainBlock, { logger: new SetnryLogger() });\n```\n\n##### onStartExec\n\nThis method invoked right before anything else - as the first thing\nin [Process#exec](#processexec). Even before any [LogicBase#hubBefore](#logicbasehubbefore).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that just started execution process\n\n##### onStartHandling\n\nInvoked right before command will go through all [LogicBase#hubBefore](#logicbasehubbefore) or [LogicBase#hubAfter](#logicbasehubafter)\nup in the blocks tree. The second argument indicates is it called for [LogicBase#hubBefore](#logicbasehubbefore)\nor for [LogicBase#hubAfter](#logicbasehubafter).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that is going to go through hubs in parent blocks\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command is going through \"after\" hubs, \"before\" otherwise\n\n##### onEndHandling\n\nInvoked when the command went through all hubs and when all sync commands\nreturned from hubs was executed.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that went through all hubs\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command going through \"after\" hubs, \"before\" otherwise\n\n##### onExecuted\n\nInvoked when the command function executed and the return of the function processed –\nall returned commands executed, all async tasks started, the model updated.\nBut it invoked before the command go through \"after\" hubs.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was exectued and the return processed\n-   `result` **any** Returned object from the command's function\n\n##### onEndExec\n\nInvoked right after the command go throught \"after\" hubs. It is the final\nstage of command execution.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was fully executed and handled by parent blocks\n\n##### onCatchError\n\nInvoked if any uncaught error happened while execution of the command\nor anywhere else in the logic, like in [LogicBase#port](#logicbaseport) or in [LogicBase#computed](#logicbasecomputed).\nBy default print the error using `console.error`.\n\n**Parameters**\n\n-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** The error instance\n-   `cmd` **[Command](#command)?** Command that was executing while the error happened\n\n#### ComputedField\n\nClass for declaring computed field with model dependencies.\nGiven array shuold contain models, binded to some\nlogec. They will be passed to compute function in the same order.\nAlso they will be used to track changed and re-compute.\n\nThe class is immutable, so any call to any method will create\na new instance of `ComputedField` and the old one won't be touched.\n\n**Parameters**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** \n\n**Properties**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** An array of models with binded logic\n                                    (attached some [Process](#process))\n-   `computeFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that will be used\n                                    to compute value of the computed field.\n\n##### compute\n\nCreates a new instance of the field and set compute function in it.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that should return a value that\n                             will be used as a value for some computed field in\n                             a model. This function will be invoked with all\n                             dependency models as arguments\n\n**Examples**\n\n```javascript\n// A way to override computed field of some base logic class\n// (thanks to immutability of `ComputedField`)\nclass MyLogic extends SomeOtherLogic {\n  computed() {\n    const oldComputed = super.computed();\n    return {\n      ...oldComputed,\n\n      // Override `oldField` compute function with saved dependencies\n      // and use overrided compute function inside new compute function\n      oldField: oldComputed.compute((...deps) => {\n        return 1 > 0 || oldComputed.oldField.computeFn(...deps);\n      })\n    };\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** New instance of the ComputedField with `computeFn`\n                         set to given function.\n\n#### Mounter\n\nTo use [mount](#mount) function you need to implement a Mounter interface\nwhich should have `mount` and `unmount` functions. It is up to the developer\nhow these functions will be implemented and what view library they will use.\n\nThere is a rule that mounter and view library should follow: view of\na model should be updated only when the model updated and the update\nshouldn't touch views of children models (children views shouldn't be updated\nbecause their models is not changed).\n\nReact perfectly fits for this rule. By implementing `shuoldComponentUpdate`\nyou can control when the component should be updated and when shouldn't. In this\ncase this function should always return `false` and componenent should be\nupdated using `forceUpdate` only when the model is updated (using [observe](#observe)).\n\n**Properties**\n\n-   `mount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that should expect two arguments: model object with\n                                  attached [Process](#process) instance and [Block#View](Block#View).\n                                  It should render the model using given View (somehow).\n-   `unmount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuold unmount mounted view from DOM.\n\n**Examples**\n\n```javascript\n// Minimal react mounter which follow the rules\nclass ViewWrapper extends React.Component {\n  componentDidMount() {\n    const { model } = this.props;\n    this.stopObserver = observe(model, () => this.forceUpdate())\n  }\n  componentWillUnmount() {\n    this.stopObserver();\n  }\n  shouldComponentUpdate() {\n    return false;\n  }\n  render() {\n    const { View, model } = this.props;\n    const Logic = logicOf(model);\n    return <View model={model} Logic={Logic} />\n  }\n}\nclass ReactMounter {\n  mount(model, View) {\n    return React.render(\n      <ViewWrapper View={View} model={model} />,\n      document.querySelector('#container')\n    );\n  }\n  unmount() {\n    return React.unmountComponentAtNode(\n      document.querySelector('#container')\n    );\n  }\n}\n```\n\n#### defineCommand\n\nProvides a way to define a command in the prototype without\nusign a decorator. You should give a prototype of the logic class,\nname of the function which should be converted to a command factory\nand the decorator function (optional).\n\nIf the decorator function is not provided, then [cmd](#cmd) will be used\nby default.\n\n**Parameters**\n\n-   `proto` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Logic class prototype\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Method name that you want to convert to a command factory\n-   `decorator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** Optional decorator function\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n  // throttle 100\n  ThrottledCommand() {\n    return this.SomeCommand();\n  }\n}\n\ndefineCommand(MyLogic.prototype, 'SomeCommand');\ndefineCommand(MyLogic.prototype, 'ThrottledCommand', cmd({ throttle: 100 }));\n```\n\n#### ensureCommand\n\nReturns a [Command](#command) instance or throw an error if given\nargument can't be used to create a [Command](#command) (is not a Command\nor command factory).\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** [Command](#command) instance or command factory. When\n                                     command factory then it will be invoked with\n                                     no arguments to create a command\n\n**Examples**\n\n```javascript\nclass MyLogic() {\n  \\@cmd SomeCommand() {\n    // do something\n  }\n}\n\nconst logic = new MyLogic();\nensureCommand(logic.SomeCommand) // returns Command instance\n// equals to...\nlogic.SomeCommand()\n```\n\nReturns **[Command](#command)** \n\n#### decorateLogic\n\nBy given logic class go through prototypes chain and\ndecorate all cmd functions. Use it if you can't use decorators\nin your project\n\nIt determine that the function should be converted to a command\nfactory (decorated by [cmd](#cmd)) by its name. If the function\nstarts with uppercase letter or underscore+upper-letter, then it\nis considered as a command.\n\n**Parameters**\n\n-   `LogicClass` **[LogicBase](#logicbase)** Logic class that you want to decorate\n-   `deep` **bool** If true then it will go though prototypes chain and\n                        decorate every prototype in the chain.\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n  }\n  _SomePrivateCommand() {\n  }\n  notACommand() {\n    return 123;\n  }\n}\n\n// `SomeCommand` and `_SomePrivateCommand` will be decorated with `cmd`\n// (the prorotype will be changed in-place). `notACommand` won't\n// be decorated.\ndecorateLogic(MyLogic);\n\nconst logic = new MyLogic();\nlogic.SomeCommand() // returns Command instance\nlogic._SomePrivateCommand() // returns Command instance\nlogic.notACommand() // returns 123\n```\n\n#### handleBefore\n\nFunction adds a handler to the [Process](#process) attached to a given\nmodel that will be invoked before every command running for this\nmodel. The handler won't be invoked for commands from children\nmodels of given model.\n\nReturns a function that removes the handler from the Process\n(stop handling)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called before every own command\n\n**Examples**\n\n```javascript\nimport { handleBefore, run, logicOf } from 'mangojuice-core';\n\n// Define root and child logic\nclass ChildLogic {\n  \\@cmd ChildCommand() {}\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  \\@cmd RootCommand() {}\n}\n\n// Run block with empty models\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ childModel: {} })\n});\n\n// Adds a handler to a root model\nhandleBefore(res.model, (cmd) => console.log(cmd));\n\n// Run commands on root and child models\nres.proc.exec(logicOf(res.model).RootCommand);\nres.proc.exec(logicOf(res.model.childModel).ChildCommand);\n\n// In the console will be printed only `RootCommand` command object\n// right before the command will be executed\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### handleAfter\n\nIt is the same as [handleBefore](#handlebefore) but the handler will be invoked\n**after** every own command.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### handle\n\nAlias for [handleAfter](#handleafter)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### logicOf\n\nReturns a Logic instance attached to a given model object. The logic\ninstance stored in attached [Process](#process) instance, so it execute\n[procOf](#procof) for the model to get a [Process](#process) instance and then\nget the logic instance form a Process and return it.\n\nIf Process is not attached to the model, then an Error will be throwed.\nIf the second argument passed then it will also check that the logic\ninstance is instance of some particular class.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `logicClass` **Class?** Optional logic class to check that the logic\n                                  instance is instance of the class\n\nReturns **[LogicBase](#logicbase)** Returns a logic instance\n\n#### observe\n\nA function that adds a handler to the [Process](#process) instance attached\nto a given model, that will be invoked on every command that changed\nthe model. Useful for tracking changes to re-render a view of the model.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process) instance\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be invoked after every command\n                                that changed the model.\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object with options\n    -   `options.batched` **bool** If true then the handler will be invoked only when\n                                        the commands stack is empty and model was changed during\n                                        the stack execution. Useful to reduce amount of not necessary\n                                        view re-renderings.\n\n**Examples**\n\n```javascript\nimport { run, cmd, observe, logicOf } from 'mangojuice-core';\n\nclass MyLogic {\n  \\@cmd MultipleUpdates() {\n    return [\n      this.UpdateOne,\n      this.UpdateTwo\n    ];\n  }\n  \\@cmd UpdateOne() {\n    return { one: this.model.one + 1 };\n  }\n  \\@cmd UpdateTwo() {\n    return { two: this.model.two + 1 };\n  }\n}\n\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ one: 1, two: 1 })\n});\n\nobserve(res.model, () => console.log('not-batched'));\nobserve(res.model, () => console.log('batched'), { batched: true });\n\nres.proc.exec(logicOf(res.model).MultipleUpdates);\n\n// `not-batched` will be printed two times\n// `batched` will be printed only once\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n#### procOf\n\nGet a [Process](#process) instance attached to the given model object.\nInternally it get a `__proc` field from the given model and returns it.\n\nIf given model do not have attached Process, then an Error will be throwed,\nbut only if the second argument is not true, which ignores the error.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `ignoreError` **bool** If true then no error will be throwed if Process\n                               is not attached to the model\n\nReturns **[Process](#process)** An instance of [Process](#process) attached to the model\n\n#### bind\n\nThis function do the following:\n\n-   Creates a model object using [Block#createModel](Block#createModel). It is invoked without\n    arguments.\n-   Create a [Process](#process) instance with logic from [Block#Logic](Block#Logic)\n-   Call [Process#bind](#processbind) with created model\n\nReturns an object with created process instance, model object and given block.\nUsefull when you want to prepare the block to run but you want to run it manually.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A [Block](#block) object\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options object that could change [Process](#process) behaviour (optional, default `{}`)\n    -   `opts.logger` **[DefaultLogger](#defaultlogger)?** A custom logger instance that will be used in the\n                                               Process to track commands execution. By default\n                                               [DefaultLogger](#defaultlogger) will be used.\n    -   `opts.shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object that will be available in any logic in the\n                                          tree as `this.shared`. Could be anything you want, but\n                                          you will get more benifites if you will pass model object\n                                          with attached Process as shared object to be able to make\n                                          computed fields with depending of shared model.\n    -   `opts.args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>?** An array of arguments that will be passed to [LogicBase#config](#logicbaseconfig)\n                                               of the logic.\n    -   `opts.Process` **[Process](#process)?** A class that will be used instead of [Process](#process). By default\n                                          general [Process](#process) is used, but you can customize it for your\n                                          specific needs and pass here. Then every other process in the tree\n                                          will be an instance of this custom [Process](#process) implementation\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block)}** An object with [Process](#process) instance, model object and block that was passed to\n   the function\n\n#### hydrate\n\nThis function replace a `createModel` function in given block\nwith new function that just returns a given model. It is useful\nwhen you have some old model and just want to run everytihing with\nit (for example for server rendering, or hot module replacement)\n\n**Parameters**\n\n-   `block` **[Block](#block)** An original block\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to use\n\n**Examples**\n\n```javascript\n// Hot module replacement example\nimport MyBlock from './MyBlock';\nimport { hydrate, run } from 'mangojuice-core';\n\n// Run initial block\nlet res = run(MyBlock);\n\n// When block changed destroy the old process, hydrate a new\n// block with existing model and run hydrated new block again\nmodule.hot.accept(['./MyBlock'], () => {\n  res.proc.destroy();\n  const newBlock = hydrate(require('./MyBlock'), res.model);\n  res = run(newBlock);\n});\n```\n\nReturns **[Block](#block)** A new block with replaced `createModel` function\n                 which just returns a model that you passed as\n                 second argument.\n\n#### delay\n\nA helper function for delaying execution. Returns a Promise\nwhich will be resolved in given amount of milliseconds. You can\nuse it in [task](#task) to implement some delay in execution, for\ndebouncing for example.\n\n**Parameters**\n\n-   `ms` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** An amount of milliseconds to wait\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that resolved after given amount of milliseconds\n\n## Basic\n\nThe most common APIs that you will work with most of the time\n\n### Block\n\nBlock is a top level component in MangoJuice which consists of three parts:\n\n-   Model factory function `createModel` which should return a plain object.\n    The main requirement for this function is that it should be able to return\n    some model with zero arguments. But it can also accept some arguments\n    as well.\n-   A logic class which implements [LogicBase](#logicbase) interface\n-   A View function which is aimed to render the model created by `createModel`\n\nThe View part is optional and it could have different type depending on\nselected View library to render a model and particular binding library.\n\n**Properties**\n\n-   `Logic` **[LogicBase](#logicbase)** A logic class that should be attached to the model.\n-   `createModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuld return a plain object which\n                                      will be an init model of the block.\n-   `View` **any?** Something that some particular view library can render\n\n**Examples**\n\n```javascript\n// You can define block in short way using an object\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nrun(MyBlock);\n```\n\n```javascript\n// Or you can split it with modules (recommended)\n// ./MyBlock/index.js\nimport Logic from './Logic';\nimport View from './View';\nimport { createModel } from './Model';\nexport default { View, Logic, createModel };\nexport { View, Logic, createModel };\nexport type { Model } from './Model';\n\n// ./MyBlock/Logic.js\nimport type { Model } from './Model';\nimport { LogicBase, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  \\@cmd SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n}\n\n// ./MyBlock/Model.js\nexport type Model = { field: number };\nexport const createModel = () => ({\n  field: 1\n});\n\n// ./MyBlock/View.js\nconst MyBlockView = ({ model }) => (\n  <div>{model.field}</div>\n);\nexport default MyBlockView;\n\n// ./index.js\nimport MyBlock from './MyBlock';\nimport { run } from 'mangojuice-core';\n\nrun(MyBlock);\n```\n\n### LogicBase\n\nBasic class for every logic. It is not necessaty to inherit an actual logic\nclass from it, but for better type-checking it could be really usefull.\n\nLogic class defines:\n\n-   A set of commands that could change an associated model – methods decorated with [cmd](#cmd)\n-   What fields of the model should be associated with which logic class\n    (children blocks) – [LogicBase#children](#logicbasechildren) method\n-   A set of computed model fields – [LogicBase#computed](#logicbasecomputed) method\n-   A set of rules to handle commands from children logic – [LogicBase#hubAfter](#logicbasehubafter)\n    and [LogicBase#hubBefore](#logicbasehubbefore) methods\n-   A logic to handle external events – [LogicBase#port](#logicbaseport) method.\n\nThe logic class defines all the business-logic of some part of your application.\nThe main goal of the logic – change associated model. Check [cmd](#cmd) and [Process#exec](#processexec)\nto have a better understanding how command can be defined and how it is executed.\n\n**Properties**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object which is associated with the\n                               logic class in parent logic.\n-   `meta` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object defined in [LogicBase#config](#logicbaseconfig) method for storing\n                               some internal logic state.\n-   `shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object with some shared state, defined while\n                               run process of the app.\n\n**Examples**\n\n```javascript\n// ./blocks/MyBlock/Logic.js\n// @flow\nimport type { Model } from './Model';\nimport ChildBlock from '../ChildBlock';\nimport { Command, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  children() {\n    return { child: ChildBlock.Logic };\n  }\n  hubAfter(cmd: Command) {\n    if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n      return this.TestCommand(123);\n    }\n  }\n  \\@cmd TestCommand(arg) {\n    return { field: arg + this.model.field };\n  }\n}\n```\n\n#### config\n\nA function that defines init commands and meta object of the\nlogic. Can accept any type and number of arguments. Config\nwill take arguments passed to [child](#child) function (for example\n`child(MyLogic, 1, 2, 3)` defines that the `config` method of\n`MyLogic` will be invoked like `config(1, 2, 3)`)\n\nCould return an object with the fields:\n\n-   `initCommands` which could be an array or a single Command,\n    that will be executed every time when the logic instance created\n    and associated with some model (when [Process#run](#processrun) invoked)\n-   `meta` which could be an object with some internal state of\n    the logic\n\n**Examples**\n\n```javascript\nconfig(props) {\n  return {\n    initCommands: [ this.StartThis, this.SendThat(123) ],\n    meta: { something: props.amount }\n  };\n}\n```\n\n#### children\n\nThis function defines what logic class should be associated\nwith which model field. Should return an object where a key is\na model field name, and a value is a logic class or an object\nthat defines logic with arguments (return from [child](#child) function)\n\n**Examples**\n\n```javascript\nchildren() {\n  return {\n    searchForm: child(SearchForm.Logic, { timeout: 100 }),\n    searchResults: SearchResults.Logic\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n#### computed\n\nShould return an object which defines computed fields of the model.\nA key of the object is a model field, and value is a function or\ncomputed function definition object (return from [depends](#depends) function).\n\nComputed field is lazy, which means that it is computed on the first use\nof the field and the computation result cached until the next update\nof the model.\n\nIf you want to define a computed field which ueses in computation not\nonly fields from the own model, but maybe some values from child model,\nor from shared model, then you will need to use [depends](#depends) function to\ndefine what models used while computation to observe changes of these\nmodels to trigger an update event of the own model (to update views).\n\n**Examples**\n\n```javascript\ncomputed() {\n  return {\n    simple: () => this.model.a + this.model.b,\n    withDeps: depends(this.model.child, this.shared).compute(() => {\n      return this.model.child.a + this.shared.b + this.model.c;\n    })\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n#### port\n\nA function to handle global event, such as browser-level events,\nwebsocket, intervals. The main porpouse of the `port` is to subscribe\nto some global events, execute appropriate commands from the logic\non the events and remove the handlers when the logic was destroyed.\n\n**Parameters**\n\n-   `exec` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** It is a function that execute a passed command\n-   `destroyed` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that will be resolved when the logic destroyed\n\n**Examples**\n\n```javascript\nport(exec, destroyed) {\n  const timer = setInterval(() => {\n    exec(this.SecondPassed);\n  }, 1000);\n  destroyed.then(() => clearInterval(timer));\n}\n```\n\n#### hubAfter\n\nHub for all commands executed in the children blocks. The only\narguments is a command object that was executed.\nCould return a Command or an array of Commands that should\nbe executed next.\nMost of the time this function will look like a `switch`,\nbut maybe with some additional rules for the cases. Take a look\nto [Command#is](#commandis) function to have a better understanding how you\ncan determine that the command is exactly what you are waiting for.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was executed in some child logic\n                           or in any child of the child and so on down to\n                           the leaf of the tree.\n\n**Examples**\n\n```javascript\nhubAfter(cmd) {\n  if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n    return this.HandlerCommand(123);\n  }\n  if (cmd.is('AnotherChild.SomeAnothercommand')) {\n    return [ this.HandlerCommand(321), this.AnotherHandler ];\n  }\n}\n```\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)**\n\n#### hubBefore\n\nSame as [LogicBase#hubAfter](#logicbasehubafter), but catch commands before\nit will be actually executed, so you can compare prev and next\nmodel state for example.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)**\n\n### cmd\n\nDecorator that converts a logic method to a command factory.\nThe result function (command factory function) is a function\nthat return a [Command](#command) instnace with the decorated function\nand arguments that you will pass to a command factory function.\n\nYou can use this decorator without arguments or with an options\nargument (object)\n\nCheck [Process#exec](#processexec) to see what the origin function\ncould return to do something. If in short, it can return:\nnothing, command (or factory or array of commands), task,\nmodel update object.\n\n**Parameters**\n\n-   `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** If only this argument passed then it will be considered\n                                   as options object which can customize command behaviour.\n    -   `obj.debounce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be debounced by given amount of\n                                       milliseconds\n    -   `obj.throttle` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be throttled by given amount of\n                                       milliseconds\n    -   `obj.noInitCall` **bool** If true then debounced/throttled execution\n                                       won't start with init command call. By default\n                                       debounced/throttled command will be instantly\n                                       exected and only then wait for a chance to execute\n                                       again. With `noInitCall=true` there is no instant init\n                                       command call.\n    -   `obj.internal` **bool** Make the command invisible for parent [LogicBase#hubBefore](#logicbasehubbefore)\n                                       and [LogicBase#hubAfter](#logicbasehubafter). Use it for commands that shouldn't\n                                       be handled by hubs to increse performance.\n    -   `obj.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** By default name of the command taken from origin function. With this\n                                       option you can override the name with any other value.\n-   `methodName`\n-   `descr`\n\n**Examples**\n\n```javascript\nclass RegularLogic {\n  \\@cmd RegularCommand() {\n    // do something\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ debounce: 300 })\n  DebouncedCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 600ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300 })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300, noInitCall: true })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 1 time in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ internal: true })\n  _InternalCommand() {\n    // this command can't be caught in `hubBefore` or `hubAfter`\n    // in parent logics. Use it carefully.\n  }\n}\n```\n\nReturns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory function (if all three arguemnts passed)\n                               or a decorator function with binded options object\n                               (that you pass as a first argument)\n\n### run\n\nRun given block. It is a short-hand function for running [bind](#bind)\nand then running a Process by [Process#run](#processrun).\nAlso it returns an additional `finished` Promise which is resolved\nwhen all async tasks finished and all handler commands executed.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A block that you wan to run\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Same options as in [bind](#bind) (optional, default `{}`)\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block), finished: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)}** An object\n                 which is almost the same as returned from [bind](#bind), but with\n                 additional `finished` field, which is a Promise that will be resolved\n                 when all blocks will execute all commands and all async tasks will be\n                 finished.\n\n### mount\n\nMount running block. As third and next arguments you can pass other running\nblocks which will be stopped with the main running block (useful for HMR).\n\n**Parameters**\n\n-   `mounter` **[Mounter](#mounter)** An implementation of [Mounter](#mounter) interface\n-   `runRes` **{proc: [Process](#process), block: [Block](#block), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}** An object that returned\n                     from [run](#run) function.\n-   `otherBlocks` **...any**\n\n**Examples**\n\n```javascript\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nmount(new ReactMounter(), run(MyBlock));\n```\n\nReturns **{view: any, stop: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)}** An object with the result form [Mounter#mount](Mounter#mount)\n                 function (in `view` field) and stop function which destroy the process and\n                 unmount a view using [Mounter#unmount](Mounter#unmount)\n\n### task\n\nCreates a [TaskMeta](#taskmeta) object that could be returned from\nasync task command. It describes the task that should be executed.\n\nFor more information what the **Task** is and how it should be implemented\ntake a look to [TaskMeta](#taskmeta).\n\n**Parameters**\n\n-   `taskFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that could return a Promise\n\n**Properties**\n\n-   `CANCEL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A symbol that you can use to make a promise \"cancellable\"\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n### cancel\n\nThis function should be used to cancel async [task](#task) execution.\nAlso it can cancel the debounced/throttled command.\n\n-   In case with task, if task was executing while you call a cancel command,\n    the task will be cancelled (execution stopped). Otherwise nothing will happen.\n-   In case with debounced/throttled command, if the command scheduled to be executed\n    then the schedule timer will be cleared and the command won't be executed.\n    If the command is not scheduled then nothing happens.\n\nTo use it just pass a command or command factory as a first argument\nand return it from some other command.\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Command or command factory that you wan to cancel. Could\n                                    be a command that returns [task](#task) or debounced/throttled\n                                    command\n\n**Examples**\n\n```javascript\nclass SomeLogic {\n  \\@cmd CancelSomethingCommand() {\n    return [\n      cancel(this.TaskCommand),\n      cancel(this.DebounceCommand)\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask);\n  }\n  \\@cmd({ debounce: 300 })\n  DebounceCommand() {\n    // do something\n  }\n}\n```\n\nReturns **[Command](#command)** Returns a new command that will cancel the execution of the command\n                  passed as an argument.\n\n### child\n\nCreates an object which describes child logic which will be attached\nto some model field. Should be used in [LogicBase#children](#logicbasechildren) to\ndefine a logic that should be instantiated with some arguments passed\nto [LogicBase#config](#logicbaseconfig).\n\n**Parameters**\n\n-   `logicClass` **[LogicBase](#logicbase)** Class that imlements [LogicBase](#logicbase) interface\n-   `args` **...any**\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  config(amount) {\n    return { meta: { amount } };\n  }\n}\nclass RootLogic {\n  children() {\n    return {\n      modelField: child(ChildLogic, 10)\n      // `config` of `ChildLogic` will be invoked with\n      // `10` as a first argument\n    }\n  }\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object that contains a logic class and an arguments array that\n                 should be used to invoke `config` method of provided logic class.\n\n### depends\n\nFunction that helps to describe a computed field with external\nmodel dependncies. Should be used in [LogicBase#computed](#logicbasecomputed).\nIt creates an instance of [ComputedField](#computedfield) with dependencies\npassed as arguments.\n\nA compute field with external dependencies is a field that should\nbe updated (re-computed) not only when the own model udpated, but\nalso when depdendency models updated.\n\n**Parameters**\n\n-   `deps` **...deps** A list of models with attached logic\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  // some logic\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  computed() {\n    return {\n      // depends on `childModel`\n      computedField: depends(this.model.childModel).compute(() => {\n        return this.model.a + this.model.childModel.b;\n      }),\n\n      // depends on `shared` model\n      computeWithShared: depends(this.shared).compute(() => {\n        return this.model.b + this.shared.someField;\n      })\n    }\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)**\n\n## Extras\n\nOther pieces of MangoJuice\n\n### Process\n\nThe main class of MangoJuice that ties model, logic and view together.\n\nIt works in the following way:\n\n-   You create a model for your app (object) using `createModel` of\n    the root block. The result is a plain object.\n-   Then you need to create an instance of Process and pass logic class\n    in the options object.\n-   Then you `bind` the Process instance to the model object you created on step one.\n    \"To bind Process to a model\" means that in the model will be created a hidden\n    field `__proc` with a reference to the Process instance.\n-   After that you can `run` the Process, which will execute init commands, port.\n\n`bind` and `run` also look at the object returned from [LogicBase#children](#logicbasechildren)\nand create/run Process instances for children models.\n\nMost of the time you do not need to care about all of these and just use\n[run](#run) and [mount](#mount). These small functions do everything described\nabove for you.\n\n**Examples**\n\n```javascript\nimport { Process, logicOf } from 'mangojuice-core';\n\nconst ExampleBlock = {\n  createModel() {\n    return { a: 10 };\n  },\n  Logic: class Example {\n    \\@cmd Increment(amount = 1) {\n      return { a: this.model.a + amount };\n    }\n  }\n};\n\nconst model = ExampleBlock.createModel();\nconst proc = new Process({ logic: ExampleBlock.Logic });\nproc.bind(model);\nproc.run();\nproc.exec(logicOf(model).Increment(23));\n```\n\n#### bind\n\nBind the process instance to a given model, which means that hidden\n`__proc` field will be created in the model with a reference to the\nProcess instance.\n\nAlso bind all children models – go through children definition returned\nby [LogicBase#children](#logicbasechildren), create Process for each child and bind\nit to an appropreat child model object.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to bind to the Process.\n\n#### run\n\nRun the process – run children processes, then run port and\ninit commands defined in config.\nAlso run all model observers created by [observe](#observe)\n\n#### destroy\n\nDestroy the process with unbinding from the model and cleaning\nup all the parts of the process (stop ports, computed fields).\n`__proc` field will be removed from the model object and all\nchildren objects.\n\n**Parameters**\n\n-   `deep` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then all children blocks will be destroyed.\n                             By default, if not provided then considered as true.\n\n#### exec\n\nExec a command in scope of the Process instance.\nIt will use binded model and logic object to run the\ncommand. The command could be function (command factory)\nor object ([Command](#command) instance).\n\nA command origin function could return three types of things:\n\n-   Another [Command](#command)/command factory or an array of commands\n    (an element of the array also could be another array with commands\n    or null/undefined/false). All commands will be execute in provided order.\n-   An instance of [TaskMeta](#taskmeta) (which is usually created by [task](#task)\n    helper function). The returned task will be started and do not block\n    execution of next commands in the stack.\n-   A plain object which is a model update object. The object will be merged\n    with current model.\n\nIf command is undefined or `Process` instance not binded\nto any model it will do nothing.\n\n**Parameters**\n\n-   `cmd` **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory or Command instance\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  \\@cmd BatchCommand() {\n    return [\n      1 > 2 && this.SomeCoomand,\n      this.AnotheCommand(123),\n      2 > 1 && [\n        this.AndSomeOtherCommand,\n        this.FinalCommand()\n      ]\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n  }\n  \\@cmd ModelUpdateCommand() {\n    if (Math.random() > 0.6) {\n      return { field: Date.now() };\n    }\n  }\n}\n```\n\n#### finished\n\nReturns a promise which will be resolved when all async\ntasks and related handlers in the process and all children\nprocesses will be finished.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**\n\n### Command\n\nClass which declares a command that will be executed in the\nfuture by some [Process#exec](#processexec). It contains a function that will be\nexecuted, arguments that should be passed to the function\nand command name.\n\nThe command also keep a context that should be used to execute\na function. Usually this context is some logic instance. You\ncan bind a context to the command using [Command#bind](#commandbind) function.\n\nThe command instance is immutable, so any function that\nmakes some change in the command will produce a new command\ninstead of changing the original one.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>**\n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n\n**Properties**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** An origin function that should be executed\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** A set of arguments that should be used\n                                 to execute the fucntion.\n\n#### exec\n\nExecute a function stored in the command instance. It passes\nstored arguments to the function and call it in stored context.\nReturns the value that was returned form the function.\n\nReturns **any**\n\n#### clone\n\nClone instance of the command\n\nReturns **[Command](#command)**\n\n#### is\n\nCheck is the command equal to some other command or have\na reference to the same origin function. Optionally you can also\ncheck that the command binded to some concrete model (using\nthe second argument).\n\nYou can use many different formats to define the command to check:\n\n-   Just a string, which should be constructed like\n    `Logic Class Name + Function Name`\n-   Command object or command factory that you can get from prorotype\n    of some logic class.\n-   Binded command object or command factory that you can get from\n    concrete model using [logicOf](#logicof) function\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Command object or command factory or command name\n-   `childModel` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Model object that should be binded to the command (optional)\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  \\@cmd SomeCommand() {}\n}\nclass MyLogic {\n  hubAfter(cmd) {\n    if (cmd.is('ChildLogic.SomeCommand')) {\n      // by command name\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand)) {\n      // by command factory\n    }\n    if (cmd.is(logicOf(this.model.child).SomeCommand)) {\n      // by binded to a concrete model command factory (commands\n      // binded for other models will be ignored)\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand, this.model.child)) {\n      // by command factory and concrete child model (commands\n      // binded for other models will be ignored)\n    }\n  }\n}\n```\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the command have same name, or same origin function\n                                and binded to same model (if second argument provided)\n\n#### appendArgs\n\nCreates a new Command instance (clone the command) and append\ngiven list of arguments to the current list of arguments.\nReturns a new Command with new list of arguments.\n\n**Parameters**\n\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of arguments that will be appened\n                               to tne new Command\n\nReturns **[Command](#command)** New command with appended arguments\n\n#### bind\n\nCreates a new Command instance and set given logic instance in it.\nAlso update command name by name of the origin function and name\nof the logic class.\n\n**Parameters**\n\n-   `logic` **[LogicBase](#logicbase)** A logic instance that should be binded to a command\n\nReturns **[Command](#command)** New command binded to given logic instance\n\n### TaskMeta\n\nClass for declaring an async task. An instance of this object returned\nfrom [taks](taks) function.\n\nA task function is a function that could return a Promise. The resolved value\nwill be passed to a success command handler, the rejected command will be passed\nto a fail command handler.\n\nIf task function do not return a Promise, then the returned value passed to a\nsuccess command, and if the function throw an error then the error passed to\na fail command.\n\nThe task function receive at least one argument – an object with `model`, `shared`\nand `meta`. All the next arguments will be given from a command that returned a task,\nif it is not overrided by [TaskMeta#args](#taskmetaargs)\n\nBy default a task is single-threaded. It means that every call to a task will cancel\npreviously running task if it is running. You can make the task to be multi-threaded\nby [TaskMeta#multithread](#taskmetamultithread), so every call to a task won't cancel the running one.\n\nIn a context of the task function defined special `call` function. This function should\nbe used to invoke sub-tasks. It is important to use `call` to run sub-tasks because\n`call` create a cancellation point of the task – if the task cancelled, then nothing\nwill be executed after currently running `call` sub-task.\n\n`call` returns an object with `result` and `error` fields. If `error` field is not\nempty, then something weird happened in the sub-task. `call` internally have a try/catch,\nso it is not necessary to wrap it with try/catch, just check the `error` field in the\nreturned object and if it is not empty – handle it somehow (throw it, or do any custom\nerror handling)\n\nAlso in a context of the task defined a `notify` function. It is a function that execute\nnotify command if it is defined. The command executed with the same arguments as passed\nto `notify` function. You can use it to incrementally update a model while the long\ntask is executing, to show some progress for the user.\n\n**Parameters**\n\n-   `taskFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n-   `executor` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n\n**Examples**\n\n```javascript\nasync function SubTask(a, b, c) {\n  this.notify(a + b + c);\n  await this.call(delay, 100);\n  return (a / b * c);\n}\nasync function RootTask({ model }) {\n  const { result, error } = await this.call(SubTask, 1, 0, 3);\n  if (error) {\n    throw new Error('Something weird happened in subtask')\n  }\n  return result + 10;\n}\n```\n\n```javascript\nclass MyLogic {\n  \\@cmd AsyncCommand() {\n    return task(Tasks.RootTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n      .notify(this.NotifyCommand)\n  }\n}\n```\n\n#### notify\n\nSet a notify handler command. This command executed by call of `this.notify`\ninside a task with the same arguments as passed to `this.notify`\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### success\n\nSet a success handler command. Will be executed with a value returned\nfrom the task, or if the task returned a Promise – with resovled value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### fail\n\nSet a fail handler command. Will be executed with error throwed in the task,\nor if the task returned a Promise – with rejected value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### multithread\n\nDefine the task to be \"multi-thread\", so every call\nwill run in parallel with other calls of the same task\nin scope of one process (model).\n\n**Parameters**\n\n-   `val` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### engine\n\nSet task executor function. The executor function should return an object\nthat should have at least two fields: `exec` and `cancel` functions.\n`exec` should return a promise which should be resolved or rejected\nwith an object `{ result, error }`. A `cancel` function should stop\nthe task execution.\n\n**Parameters**\n\n-   `engine` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that returns\n                               `{ exec: Function, cancel: Function }` object\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### args\n\nOverride arguments which will be passed to the task\nstarting from second argument. By default a task will receive\nthe same set of arguments as a task command. If this function invoked,\nthen the task will receive given arguments instead of command arguments.\n\n**Parameters**\n\n-   `args` **...any**\n\nReturns **[TaskMeta](#taskmeta)**\n\n### DefaultLogger\n\nA class which defins a logger for tracking command execution process.\nThe default implmenetation just defines all possible logger\nmethods (log points) and print errors to the console.\nExtend this class to define your own logging functionality\n(like logging errors with Setnry or Loggly)\n\n**Examples**\n\n```javascript\n// ./index.js\nimport { DefaultLogger, run } from 'mangojuice-core';\nimport MainBlock from './blocks/MainBlock';\n\n// Implement custom logger\nclass SetnryLogger extends DefaultLogger {\n  onCatchError(error, cmd) {\n    Raven.catchException(error);\n  }\n}\n\n// Pass instance of the Logger to `run` options object.\nrun(MainBlock, { logger: new SetnryLogger() });\n```\n\n#### onStartExec\n\nThis method invoked right before anything else - as the first thing\nin [Process#exec](#processexec). Even before any [LogicBase#hubBefore](#logicbasehubbefore).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that just started execution process\n\n#### onStartHandling\n\nInvoked right before command will go through all [LogicBase#hubBefore](#logicbasehubbefore) or [LogicBase#hubAfter](#logicbasehubafter)\nup in the blocks tree. The second argument indicates is it called for [LogicBase#hubBefore](#logicbasehubbefore)\nor for [LogicBase#hubAfter](#logicbasehubafter).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that is going to go through hubs in parent blocks\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command is going through \"after\" hubs, \"before\" otherwise\n\n#### onEndHandling\n\nInvoked when the command went through all hubs and when all sync commands\nreturned from hubs was executed.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that went through all hubs\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command going through \"after\" hubs, \"before\" otherwise\n\n#### onExecuted\n\nInvoked when the command function executed and the return of the function processed –\nall returned commands executed, all async tasks started, the model updated.\nBut it invoked before the command go through \"after\" hubs.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was exectued and the return processed\n-   `result` **any** Returned object from the command's function\n\n#### onEndExec\n\nInvoked right after the command go throught \"after\" hubs. It is the final\nstage of command execution.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was fully executed and handled by parent blocks\n\n#### onCatchError\n\nInvoked if any uncaught error happened while execution of the command\nor anywhere else in the logic, like in [LogicBase#port](#logicbaseport) or in [LogicBase#computed](#logicbasecomputed).\nBy default print the error using `console.error`.\n\n**Parameters**\n\n-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** The error instance\n-   `cmd` **[Command](#command)?** Command that was executing while the error happened\n\n### ComputedField\n\nClass for declaring computed field with model dependencies.\nGiven array shuold contain models, binded to some\nlogec. They will be passed to compute function in the same order.\nAlso they will be used to track changed and re-compute.\n\nThe class is immutable, so any call to any method will create\na new instance of `ComputedField` and the old one won't be touched.\n\n**Parameters**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**\n\n**Properties**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** An array of models with binded logic\n                                    (attached some [Process](#process))\n-   `computeFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that will be used\n                                    to compute value of the computed field.\n\n#### compute\n\nCreates a new instance of the field and set compute function in it.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that should return a value that\n                             will be used as a value for some computed field in\n                             a model. This function will be invoked with all\n                             dependency models as arguments\n\n**Examples**\n\n```javascript\n// A way to override computed field of some base logic class\n// (thanks to immutability of `ComputedField`)\nclass MyLogic extends SomeOtherLogic {\n  computed() {\n    const oldComputed = super.computed();\n    return {\n      ...oldComputed,\n\n      // Override `oldField` compute function with saved dependencies\n      // and use overrided compute function inside new compute function\n      oldField: oldComputed.compute((...deps) => {\n        return 1 > 0 || oldComputed.oldField.computeFn(...deps);\n      })\n    };\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** New instance of the ComputedField with `computeFn`\n                         set to given function.\n\n### Mounter\n\nTo use [mount](#mount) function you need to implement a Mounter interface\nwhich should have `mount` and `unmount` functions. It is up to the developer\nhow these functions will be implemented and what view library they will use.\n\nThere is a rule that mounter and view library should follow: view of\na model should be updated only when the model updated and the update\nshouldn't touch views of children models (children views shouldn't be updated\nbecause their models is not changed).\n\nReact perfectly fits for this rule. By implementing `shuoldComponentUpdate`\nyou can control when the component should be updated and when shouldn't. In this\ncase this function should always return `false` and componenent should be\nupdated using `forceUpdate` only when the model is updated (using [observe](#observe)).\n\n**Properties**\n\n-   `mount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that should expect two arguments: model object with\n                                  attached [Process](#process) instance and [Block#View](Block#View).\n                                  It should render the model using given View (somehow).\n-   `unmount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuold unmount mounted view from DOM.\n\n**Examples**\n\n```javascript\n// Minimal react mounter which follow the rules\nclass ViewWrapper extends React.Component {\n  componentDidMount() {\n    const { model } = this.props;\n    this.stopObserver = observe(model, () => this.forceUpdate())\n  }\n  componentWillUnmount() {\n    this.stopObserver();\n  }\n  shouldComponentUpdate() {\n    return false;\n  }\n  render() {\n    const { View, model } = this.props;\n    const Logic = logicOf(model);\n    return <View model={model} Logic={Logic} />\n  }\n}\nclass ReactMounter {\n  mount(model, View) {\n    return React.render(\n      <ViewWrapper View={View} model={model} />,\n      document.querySelector('#container')\n    );\n  }\n  unmount() {\n    return React.unmountComponentAtNode(\n      document.querySelector('#container')\n    );\n  }\n}\n```\n\n### defineCommand\n\nProvides a way to define a command in the prototype without\nusign a decorator. You should give a prototype of the logic class,\nname of the function which should be converted to a command factory\nand the decorator function (optional).\n\nIf the decorator function is not provided, then [cmd](#cmd) will be used\nby default.\n\n**Parameters**\n\n-   `proto` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Logic class prototype\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Method name that you want to convert to a command factory\n-   `decorator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** Optional decorator function\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n  // throttle 100\n  ThrottledCommand() {\n    return this.SomeCommand();\n  }\n}\n\ndefineCommand(MyLogic.prototype, 'SomeCommand');\ndefineCommand(MyLogic.prototype, 'ThrottledCommand', cmd({ throttle: 100 }));\n```\n\n### ensureCommand\n\nReturns a [Command](#command) instance or throw an error if given\nargument can't be used to create a [Command](#command) (is not a Command\nor command factory).\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** [Command](#command) instance or command factory. When\n                                     command factory then it will be invoked with\n                                     no arguments to create a command\n\n**Examples**\n\n```javascript\nclass MyLogic() {\n  \\@cmd SomeCommand() {\n    // do something\n  }\n}\n\nconst logic = new MyLogic();\nensureCommand(logic.SomeCommand) // returns Command instance\n// equals to...\nlogic.SomeCommand()\n```\n\nReturns **[Command](#command)**\n\n### decorateLogic\n\nBy given logic class go through prototypes chain and\ndecorate all cmd functions. Use it if you can't use decorators\nin your project\n\nIt determine that the function should be converted to a command\nfactory (decorated by [cmd](#cmd)) by its name. If the function\nstarts with uppercase letter or underscore+upper-letter, then it\nis considered as a command.\n\n**Parameters**\n\n-   `LogicClass` **[LogicBase](#logicbase)** Logic class that you want to decorate\n-   `deep` **bool** If true then it will go though prototypes chain and\n                        decorate every prototype in the chain.\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n  }\n  _SomePrivateCommand() {\n  }\n  notACommand() {\n    return 123;\n  }\n}\n\n// `SomeCommand` and `_SomePrivateCommand` will be decorated with `cmd`\n// (the prorotype will be changed in-place). `notACommand` won't\n// be decorated.\ndecorateLogic(MyLogic);\n\nconst logic = new MyLogic();\nlogic.SomeCommand() // returns Command instance\nlogic._SomePrivateCommand() // returns Command instance\nlogic.notACommand() // returns 123\n```\n\n### handleBefore\n\nFunction adds a handler to the [Process](#process) attached to a given\nmodel that will be invoked before every command running for this\nmodel. The handler won't be invoked for commands from children\nmodels of given model.\n\nReturns a function that removes the handler from the Process\n(stop handling)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called before every own command\n\n**Examples**\n\n```javascript\nimport { handleBefore, run, logicOf } from 'mangojuice-core';\n\n// Define root and child logic\nclass ChildLogic {\n  \\@cmd ChildCommand() {}\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  \\@cmd RootCommand() {}\n}\n\n// Run block with empty models\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ childModel: {} })\n});\n\n// Adds a handler to a root model\nhandleBefore(res.model, (cmd) => console.log(cmd));\n\n// Run commands on root and child models\nres.proc.exec(logicOf(res.model).RootCommand);\nres.proc.exec(logicOf(res.model.childModel).ChildCommand);\n\n// In the console will be printed only `RootCommand` command object\n// right before the command will be executed\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### handleAfter\n\nIt is the same as [handleBefore](#handlebefore) but the handler will be invoked\n**after** every own command.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### handle\n\nAlias for [handleAfter](#handleafter)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### logicOf\n\nReturns a Logic instance attached to a given model object. The logic\ninstance stored in attached [Process](#process) instance, so it execute\n[procOf](#procof) for the model to get a [Process](#process) instance and then\nget the logic instance form a Process and return it.\n\nIf Process is not attached to the model, then an Error will be throwed.\nIf the second argument passed then it will also check that the logic\ninstance is instance of some particular class.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `logicClass` **Class?** Optional logic class to check that the logic\n                                  instance is instance of the class\n\nReturns **[LogicBase](#logicbase)** Returns a logic instance\n\n### observe\n\nA function that adds a handler to the [Process](#process) instance attached\nto a given model, that will be invoked on every command that changed\nthe model. Useful for tracking changes to re-render a view of the model.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process) instance\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be invoked after every command\n                                that changed the model.\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object with options\n    -   `options.batched` **bool** If true then the handler will be invoked only when\n                                        the commands stack is empty and model was changed during\n                                        the stack execution. Useful to reduce amount of not necessary\n                                        view re-renderings.\n\n**Examples**\n\n```javascript\nimport { run, cmd, observe, logicOf } from 'mangojuice-core';\n\nclass MyLogic {\n  \\@cmd MultipleUpdates() {\n    return [\n      this.UpdateOne,\n      this.UpdateTwo\n    ];\n  }\n  \\@cmd UpdateOne() {\n    return { one: this.model.one + 1 };\n  }\n  \\@cmd UpdateTwo() {\n    return { two: this.model.two + 1 };\n  }\n}\n\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ one: 1, two: 1 })\n});\n\nobserve(res.model, () => console.log('not-batched'));\nobserve(res.model, () => console.log('batched'), { batched: true });\n\nres.proc.exec(logicOf(res.model).MultipleUpdates);\n\n// `not-batched` will be printed two times\n// `batched` will be printed only once\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n\n### procOf\n\nGet a [Process](#process) instance attached to the given model object.\nInternally it get a `__proc` field from the given model and returns it.\n\nIf given model do not have attached Process, then an Error will be throwed,\nbut only if the second argument is not true, which ignores the error.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `ignoreError` **bool** If true then no error will be throwed if Process\n                               is not attached to the model\n\nReturns **[Process](#process)** An instance of [Process](#process) attached to the model\n\n### bind\n\nThis function do the following:\n\n-   Creates a model object using [Block#createModel](Block#createModel). It is invoked without\n    arguments.\n-   Create a [Process](#process) instance with logic from [Block#Logic](Block#Logic)\n-   Call [Process#bind](#processbind) with created model\n\nReturns an object with created process instance, model object and given block.\nUsefull when you want to prepare the block to run but you want to run it manually.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A [Block](#block) object\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options object that could change [Process](#process) behaviour (optional, default `{}`)\n    -   `opts.logger` **[DefaultLogger](#defaultlogger)?** A custom logger instance that will be used in the\n                                               Process to track commands execution. By default\n                                               [DefaultLogger](#defaultlogger) will be used.\n    -   `opts.shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object that will be available in any logic in the\n                                          tree as `this.shared`. Could be anything you want, but\n                                          you will get more benifites if you will pass model object\n                                          with attached Process as shared object to be able to make\n                                          computed fields with depending of shared model.\n    -   `opts.args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>?** An array of arguments that will be passed to [LogicBase#config](#logicbaseconfig)\n                                               of the logic.\n    -   `opts.Process` **[Process](#process)?** A class that will be used instead of [Process](#process). By default\n                                          general [Process](#process) is used, but you can customize it for your\n                                          specific needs and pass here. Then every other process in the tree\n                                          will be an instance of this custom [Process](#process) implementation\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block)}** An object with [Process](#process) instance, model object and block that was passed to\n   the function\n\n### hydrate\n\nThis function replace a `createModel` function in given block\nwith new function that just returns a given model. It is useful\nwhen you have some old model and just want to run everytihing with\nit (for example for server rendering, or hot module replacement)\n\n**Parameters**\n\n-   `block` **[Block](#block)** An original block\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to use\n\n**Examples**\n\n```javascript\n// Hot module replacement example\nimport MyBlock from './MyBlock';\nimport { hydrate, run } from 'mangojuice-core';\n\n// Run initial block\nlet res = run(MyBlock);\n\n// When block changed destroy the old process, hydrate a new\n// block with existing model and run hydrated new block again\nmodule.hot.accept(['./MyBlock'], () => {\n  res.proc.destroy();\n  const newBlock = hydrate(require('./MyBlock'), res.model);\n  res = run(newBlock);\n});\n```\n\nReturns **[Block](#block)** A new block with replaced `createModel` function\n                 which just returns a model that you passed as\n                 second argument.\n\n### delay\n\nA helper function for delaying execution. Returns a Promise\nwhich will be resolved in given amount of milliseconds. You can\nuse it in [task](#task) to implement some delay in execution, for\ndebouncing for example.\n\n**Parameters**\n\n-   `ms` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** An amount of milliseconds to wait\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that resolved after given amount of milliseconds\n","readmeFilename":"README.md","_id":"mangojuice-core@2.0.0-2","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-ShXZO56NU3j/T+Qk9F1OnyA7WEUvNpcVL/smw9e4+6GxRxwrh8Vw6F4wfApvrt0bZGvMIVe39qcc/JqCrQbTyw==","shasum":"5789194492ca9255580f4f2649413950e9129168","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-2.0.0-2.tgz","fileCount":34,"unpackedSize":1874572,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnmzFqUF2d/+S+U//Sqln45KlJkla9l8uYhqlW3a1zcAIgPPabiE974MVOIFYWaw5j6MvGioAgy9ToWIsOqOsOXbs="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core_2.0.0-2_1519487414724_0.5830293328664413"},"_hasShrinkwrap":false},"2.0.0-3":{"name":"mangojuice-core","version":"2.0.0-3","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"readme":"# MangoJuice Core\n\n## Reference\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n#### Table of Contents\n\n-   [Basic](#basic)\n    -   [Block](#block)\n    -   [LogicBase](#logicbase)\n        -   [config](#config)\n        -   [children](#children)\n        -   [computed](#computed)\n        -   [port](#port)\n        -   [hubAfter](#hubafter)\n        -   [hubBefore](#hubbefore)\n    -   [cmd](#cmd)\n    -   [run](#run)\n    -   [mount](#mount)\n    -   [task](#task)\n    -   [cancel](#cancel)\n    -   [child](#child)\n    -   [depends](#depends)\n-   [Extras](#extras)\n    -   [Process](#process)\n        -   [bind](#bind)\n        -   [run](#run-1)\n        -   [destroy](#destroy)\n        -   [exec](#exec)\n        -   [finished](#finished)\n    -   [Command](#command)\n        -   [exec](#exec-1)\n        -   [clone](#clone)\n        -   [is](#is)\n        -   [appendArgs](#appendargs)\n        -   [bind](#bind-1)\n    -   [TaskMeta](#taskmeta)\n        -   [notify](#notify)\n        -   [success](#success)\n        -   [fail](#fail)\n        -   [multithread](#multithread)\n        -   [engine](#engine)\n        -   [args](#args)\n    -   [DefaultLogger](#defaultlogger)\n        -   [onStartExec](#onstartexec)\n        -   [onStartHandling](#onstarthandling)\n        -   [onEndHandling](#onendhandling)\n        -   [onExecuted](#onexecuted)\n        -   [onEndExec](#onendexec)\n        -   [onCatchError](#oncatcherror)\n    -   [ComputedField](#computedfield)\n        -   [compute](#compute)\n    -   [Mounter](#mounter)\n    -   [defineCommand](#definecommand)\n    -   [ensureCommand](#ensurecommand)\n    -   [decorateLogic](#decoratelogic)\n    -   [handleBefore](#handlebefore)\n    -   [handleAfter](#handleafter)\n    -   [handle](#handle)\n    -   [logicOf](#logicof)\n    -   [observe](#observe)\n    -   [procOf](#procof)\n    -   [bind](#bind-2)\n    -   [hydrate](#hydrate)\n    -   [delay](#delay)\n\n### Basic\n\nThe most common APIs that you will work with most of the time\n\n\n#### Block\n\nBlock is a top level component in MangoJuice which consists of three parts:\n\n-   Model factory function `createModel` which should return a plain object.\n    The main requirement for this function is that it should be able to return\n    some model with zero arguments. But it can also accept some arguments\n    as well.\n-   A logic class which implements [LogicBase](#logicbase) interface\n-   A View function which is aimed to render the model created by `createModel`\n\nThe View part is optional and it could have different type depending on\nselected View library to render a model and particular binding library.\n\n**Properties**\n\n-   `Logic` **[LogicBase](#logicbase)** A logic class that should be attached to the model.\n-   `createModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuld return a plain object which\n                                      will be an init model of the block.\n-   `View` **any?** Something that some particular view library can render\n\n**Examples**\n\n```javascript\n// You can define block in short way using an object\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nrun(MyBlock);\n```\n\n```javascript\n// Or you can split it with modules (recommended)\n// ./MyBlock/index.js\nimport Logic from './Logic';\nimport View from './View';\nimport { createModel } from './Model';\nexport default { View, Logic, createModel };\nexport { View, Logic, createModel };\nexport type { Model } from './Model';\n\n// ./MyBlock/Logic.js\nimport type { Model } from './Model';\nimport { LogicBase, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  \\@cmd SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n}\n\n// ./MyBlock/Model.js\nexport type Model = { field: number };\nexport const createModel = () => ({\n  field: 1\n});\n\n// ./MyBlock/View.js\nconst MyBlockView = ({ model }) => (\n  <div>{model.field}</div>\n);\nexport default MyBlockView;\n\n// ./index.js\nimport MyBlock from './MyBlock';\nimport { run } from 'mangojuice-core';\n\nrun(MyBlock);\n```\n\n#### LogicBase\n\nBasic class for every logic. It is not necessaty to inherit an actual logic\nclass from it, but for better type-checking it could be really usefull.\n\nLogic class defines:\n\n-   A set of commands that could change an associated model – methods decorated with [cmd](#cmd)\n-   What fields of the model should be associated with which logic class\n    (children blocks) – [LogicBase#children](#logicbasechildren) method\n-   A set of computed model fields – [LogicBase#computed](#logicbasecomputed) method\n-   A set of rules to handle commands from children logic – [LogicBase#hubAfter](#logicbasehubafter)\n    and [LogicBase#hubBefore](#logicbasehubbefore) methods\n-   A logic to handle external events – [LogicBase#port](#logicbaseport) method.\n\nThe logic class defines all the business-logic of some part of your application.\nThe main goal of the logic – change associated model. Check [cmd](#cmd) and [Process#exec](#processexec)\nto have a better understanding how command can be defined and how it is executed.\n\n**Properties**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object which is associated with the\n                               logic class in parent logic.\n-   `meta` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object defined in [LogicBase#config](#logicbaseconfig) method for storing\n                               some internal logic state.\n-   `shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object with some shared state, defined while\n                               run process of the app.\n\n**Examples**\n\n```javascript\n// ./blocks/MyBlock/Logic.js\n// @flow\nimport type { Model } from './Model';\nimport ChildBlock from '../ChildBlock';\nimport { Command, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  children() {\n    return { child: ChildBlock.Logic };\n  }\n  hubAfter(cmd: Command) {\n    if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n      return this.TestCommand(123);\n    }\n  }\n  \\@cmd TestCommand(arg) {\n    return { field: arg + this.model.field };\n  }\n}\n```\n\n##### config\n\nA function that defines init commands and meta object of the\nlogic. Can accept any type and number of arguments. Config\nwill take arguments passed to [child](#child) function (for example\n`child(MyLogic, 1, 2, 3)` defines that the `config` method of\n`MyLogic` will be invoked like `config(1, 2, 3)`)\n\nCould return an object with the fields:\n\n-   `initCommands` which could be an array or a single Command,\n    that will be executed every time when the logic instance created\n    and associated with some model (when [Process#run](#processrun) invoked)\n-   `meta` which could be an object with some internal state of\n    the logic\n\n**Examples**\n\n```javascript\nconfig(props) {\n  return {\n    initCommands: [ this.StartThis, this.SendThat(123) ],\n    meta: { something: props.amount }\n  };\n}\n```\n\n##### children\n\nThis function defines what logic class should be associated\nwith which model field. Should return an object where a key is\na model field name, and a value is a logic class or an object\nthat defines logic with arguments (return from [child](#child) function)\n\n**Examples**\n\n```javascript\nchildren() {\n  return {\n    searchForm: child(SearchForm.Logic, { timeout: 100 }),\n    searchResults: SearchResults.Logic\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n##### computed\n\nShould return an object which defines computed fields of the model.\nA key of the object is a model field, and value is a function or\ncomputed function definition object (return from [depends](#depends) function).\n\nComputed field is lazy, which means that it is computed on the first use\nof the field and the computation result cached until the next update\nof the model.\n\nIf you want to define a computed field which ueses in computation not\nonly fields from the own model, but maybe some values from child model,\nor from shared model, then you will need to use [depends](#depends) function to\ndefine what models used while computation to observe changes of these\nmodels to trigger an update event of the own model (to update views).\n\n**Examples**\n\n```javascript\ncomputed() {\n  return {\n    simple: () => this.model.a + this.model.b,\n    withDeps: depends(this.model.child, this.shared).compute(() => {\n      return this.model.child.a + this.shared.b + this.model.c;\n    })\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n##### port\n\nA function to handle global event, such as browser-level events,\nwebsocket, intervals. The main porpouse of the `port` is to subscribe\nto some global events, execute appropriate commands from the logic\non the events and remove the handlers when the logic was destroyed.\n\n**Parameters**\n\n-   `exec` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** It is a function that execute a passed command\n-   `destroyed` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that will be resolved when the logic destroyed\n\n**Examples**\n\n```javascript\nport(exec, destroyed) {\n  const timer = setInterval(() => {\n    exec(this.SecondPassed);\n  }, 1000);\n  destroyed.then(() => clearInterval(timer));\n}\n```\n\n##### hubAfter\n\nHub for all commands executed in the children blocks. The only\narguments is a command object that was executed.\nCould return a Command or an array of Commands that should\nbe executed next.\nMost of the time this function will look like a `switch`,\nbut maybe with some additional rules for the cases. Take a look\nto [Command#is](#commandis) function to have a better understanding how you\ncan determine that the command is exactly what you are waiting for.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was executed in some child logic\n                           or in any child of the child and so on down to\n                           the leaf of the tree.\n\n**Examples**\n\n```javascript\nhubAfter(cmd) {\n  if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n    return this.HandlerCommand(123);\n  }\n  if (cmd.is('AnotherChild.SomeAnothercommand')) {\n    return [ this.HandlerCommand(321), this.AnotherHandler ];\n  }\n}\n```\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)** \n\n##### hubBefore\n\nSame as [LogicBase#hubAfter](#logicbasehubafter), but catch commands before\nit will be actually executed, so you can compare prev and next\nmodel state for example.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)** \n\n#### cmd\n\nDecorator that converts a logic method to a command factory.\nThe result function (command factory function) is a function\nthat return a [Command](#command) instnace with the decorated function\nand arguments that you will pass to a command factory function.\n\nYou can use this decorator without arguments or with an options\nargument (object)\n\nCheck [Process#exec](#processexec) to see what the origin function\ncould return to do something. If in short, it can return:\nnothing, command (or factory or array of commands), task,\nmodel update object.\n\n**Parameters**\n\n-   `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** If only this argument passed then it will be considered\n                                   as options object which can customize command behaviour.\n    -   `obj.debounce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be debounced by given amount of\n                                       milliseconds\n    -   `obj.throttle` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be throttled by given amount of\n                                       milliseconds\n    -   `obj.noInitCall` **bool** If true then debounced/throttled execution\n                                       won't start with init command call. By default\n                                       debounced/throttled command will be instantly\n                                       exected and only then wait for a chance to execute\n                                       again. With `noInitCall=true` there is no instant init\n                                       command call.\n    -   `obj.internal` **bool** Make the command invisible for parent [LogicBase#hubBefore](#logicbasehubbefore)\n                                       and [LogicBase#hubAfter](#logicbasehubafter). Use it for commands that shouldn't\n                                       be handled by hubs to increse performance.\n    -   `obj.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** By default name of the command taken from origin function. With this\n                                       option you can override the name with any other value.\n-   `methodName`  \n-   `descr`  \n\n**Examples**\n\n```javascript\nclass RegularLogic {\n  \\@cmd RegularCommand() {\n    // do something\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ debounce: 300 })\n  DebouncedCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 600ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300 })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300, noInitCall: true })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 1 time in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ internal: true })\n  _InternalCommand() {\n    // this command can't be caught in `hubBefore` or `hubAfter`\n    // in parent logics. Use it carefully.\n  }\n}\n```\n\nReturns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory function (if all three arguemnts passed)\n                               or a decorator function with binded options object\n                               (that you pass as a first argument)\n\n#### run\n\nRun given block. It is a short-hand function for running [bind](#bind)\nand then running a Process by [Process#run](#processrun).\nAlso it returns an additional `finished` Promise which is resolved\nwhen all async tasks finished and all handler commands executed.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A block that you wan to run\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Same options as in [bind](#bind) (optional, default `{}`)\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block), finished: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)}** An object\n                 which is almost the same as returned from [bind](#bind), but with\n                 additional `finished` field, which is a Promise that will be resolved\n                 when all blocks will execute all commands and all async tasks will be\n                 finished.\n\n#### mount\n\nMount running block. As third and next arguments you can pass other running\nblocks which will be stopped with the main running block (useful for HMR).\n\n**Parameters**\n\n-   `mounter` **[Mounter](#mounter)** An implementation of [Mounter](#mounter) interface\n-   `runRes` **{proc: [Process](#process), block: [Block](#block), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}** An object that returned\n                     from [run](#run) function.\n-   `otherBlocks` **...any** \n\n**Examples**\n\n```javascript\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nmount(new ReactMounter(), run(MyBlock));\n```\n\nReturns **{view: any, stop: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)}** An object with the result form [Mounter#mount](Mounter#mount)\n                 function (in `view` field) and stop function which destroy the process and\n                 unmount a view using [Mounter#unmount](Mounter#unmount)\n\n#### task\n\nCreates a [TaskMeta](#taskmeta) object that could be returned from\nasync task command. It describes the task that should be executed.\n\nFor more information what the **Task** is and how it should be implemented\ntake a look to [TaskMeta](#taskmeta).\n\n**Parameters**\n\n-   `taskFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that could return a Promise\n\n**Properties**\n\n-   `CANCEL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A symbol that you can use to make a promise \"cancellable\"\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n#### cancel\n\nThis function should be used to cancel async [task](#task) execution.\nAlso it can cancel the debounced/throttled command.\n\n-   In case with task, if task was executing while you call a cancel command,\n    the task will be cancelled (execution stopped). Otherwise nothing will happen.\n-   In case with debounced/throttled command, if the command scheduled to be executed\n    then the schedule timer will be cleared and the command won't be executed.\n    If the command is not scheduled then nothing happens.\n\nTo use it just pass a command or command factory as a first argument\nand return it from some other command.\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Command or command factory that you wan to cancel. Could\n                                    be a command that returns [task](#task) or debounced/throttled\n                                    command\n\n**Examples**\n\n```javascript\nclass SomeLogic {\n  \\@cmd CancelSomethingCommand() {\n    return [\n      cancel(this.TaskCommand),\n      cancel(this.DebounceCommand)\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask);\n  }\n  \\@cmd({ debounce: 300 })\n  DebounceCommand() {\n    // do something\n  }\n}\n```\n\nReturns **[Command](#command)** Returns a new command that will cancel the execution of the command\n                  passed as an argument.\n\n#### child\n\nCreates an object which describes child logic which will be attached\nto some model field. Should be used in [LogicBase#children](#logicbasechildren) to\ndefine a logic that should be instantiated with some arguments passed\nto [LogicBase#config](#logicbaseconfig).\n\n**Parameters**\n\n-   `logicClass` **[LogicBase](#logicbase)** Class that imlements [LogicBase](#logicbase) interface\n-   `args` **...any** \n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  config(amount) {\n    return { meta: { amount } };\n  }\n}\nclass RootLogic {\n  children() {\n    return {\n      modelField: child(ChildLogic, 10)\n      // `config` of `ChildLogic` will be invoked with\n      // `10` as a first argument\n    }\n  }\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object that contains a logic class and an arguments array that\n                 should be used to invoke `config` method of provided logic class.\n\n#### depends\n\nFunction that helps to describe a computed field with external\nmodel dependncies. Should be used in [LogicBase#computed](#logicbasecomputed).\nIt creates an instance of [ComputedField](#computedfield) with dependencies\npassed as arguments.\n\nA compute field with external dependencies is a field that should\nbe updated (re-computed) not only when the own model udpated, but\nalso when depdendency models updated.\n\n**Parameters**\n\n-   `deps` **...deps** A list of models with attached logic\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  // some logic\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  computed() {\n    return {\n      // depends on `childModel`\n      computedField: depends(this.model.childModel).compute(() => {\n        return this.model.a + this.model.childModel.b;\n      }),\n\n      // depends on `shared` model\n      computeWithShared: depends(this.shared).compute(() => {\n        return this.model.b + this.shared.someField;\n      })\n    }\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** \n\n### Extras\n\nOther pieces of MangoJuice\n\n\n#### Process\n\nThe main class of MangoJuice that ties model, logic and view together.\n\nIt works in the following way:\n\n-   You create a model for your app (object) using `createModel` of\n    the root block. The result is a plain object.\n-   Then you need to create an instance of Process and pass logic class\n    in the options object.\n-   Then you `bind` the Process instance to the model object you created on step one.\n    \"To bind Process to a model\" means that in the model will be created a hidden\n    field `__proc` with a reference to the Process instance.\n-   After that you can `run` the Process, which will execute init commands, port.\n\n`bind` and `run` also look at the object returned from [LogicBase#children](#logicbasechildren)\nand create/run Process instances for children models.\n\nMost of the time you do not need to care about all of these and just use\n[run](#run) and [mount](#mount). These small functions do everything described\nabove for you.\n\n**Examples**\n\n```javascript\nimport { Process, logicOf } from 'mangojuice-core';\n\nconst ExampleBlock = {\n  createModel() {\n    return { a: 10 };\n  },\n  Logic: class Example {\n    \\@cmd Increment(amount = 1) {\n      return { a: this.model.a + amount };\n    }\n  }\n};\n\nconst model = ExampleBlock.createModel();\nconst proc = new Process({ logic: ExampleBlock.Logic });\nproc.bind(model);\nproc.run();\nproc.exec(logicOf(model).Increment(23));\n```\n\n##### bind\n\nBind the process instance to a given model, which means that hidden\n`__proc` field will be created in the model with a reference to the\nProcess instance.\n\nAlso bind all children models – go through children definition returned\nby [LogicBase#children](#logicbasechildren), create Process for each child and bind\nit to an appropreat child model object.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to bind to the Process.\n\n##### run\n\nRun the process – run children processes, then run port and\ninit commands defined in config.\nAlso run all model observers created by [observe](#observe)\n\n##### destroy\n\nDestroy the process with unbinding from the model and cleaning\nup all the parts of the process (stop ports, computed fields).\n`__proc` field will be removed from the model object and all\nchildren objects.\n\n**Parameters**\n\n-   `deep` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then all children blocks will be destroyed.\n                             By default, if not provided then considered as true.\n\n##### exec\n\nExec a command in scope of the Process instance.\nIt will use binded model and logic object to run the\ncommand. The command could be function (command factory)\nor object ([Command](#command) instance).\n\nA command origin function could return three types of things:\n\n-   Another [Command](#command)/command factory or an array of commands\n    (an element of the array also could be another array with commands\n    or null/undefined/false). All commands will be execute in provided order.\n-   An instance of [TaskMeta](#taskmeta) (which is usually created by [task](#task)\n    helper function). The returned task will be started and do not block\n    execution of next commands in the stack.\n-   A plain object which is a model update object. The object will be merged\n    with current model.\n\nIf command is undefined or `Process` instance not binded\nto any model it will do nothing.\n\n**Parameters**\n\n-   `cmd` **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory or Command instance\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  \\@cmd BatchCommand() {\n    return [\n      1 > 2 && this.SomeCoomand,\n      this.AnotheCommand(123),\n      2 > 1 && [\n        this.AndSomeOtherCommand,\n        this.FinalCommand()\n      ]\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n  }\n  \\@cmd ModelUpdateCommand() {\n    if (Math.random() > 0.6) {\n      return { field: Date.now() };\n    }\n  }\n}\n```\n\n##### finished\n\nReturns a promise which will be resolved when all async\ntasks and related handlers in the process and all children\nprocesses will be finished.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n#### Command\n\nClass which declares a command that will be executed in the\nfuture by some [Process#exec](#processexec). It contains a function that will be\nexecuted, arguments that should be passed to the function\nand command name.\n\nThe command also keep a context that should be used to execute\na function. Usually this context is some logic instance. You\ncan bind a context to the command using [Command#bind](#commandbind) function.\n\nThe command instance is immutable, so any function that\nmakes some change in the command will produce a new command\ninstead of changing the original one.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** \n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n**Properties**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** An origin function that should be executed\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** A set of arguments that should be used\n                                 to execute the fucntion.\n\n##### exec\n\nExecute a function stored in the command instance. It passes\nstored arguments to the function and call it in stored context.\nReturns the value that was returned form the function.\n\nReturns **any** \n\n##### clone\n\nClone instance of the command\n\nReturns **[Command](#command)** \n\n##### is\n\nCheck is the command equal to some other command or have\na reference to the same origin function. Optionally you can also\ncheck that the command binded to some concrete model (using\nthe second argument).\n\nYou can use many different formats to define the command to check:\n\n-   Just a string, which should be constructed like\n    `Logic Class Name + Function Name`\n-   Command object or command factory that you can get from prorotype\n    of some logic class.\n-   Binded command object or command factory that you can get from\n    concrete model using [logicOf](#logicof) function\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Command object or command factory or command name\n-   `childModel` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Model object that should be binded to the command (optional)\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  \\@cmd SomeCommand() {}\n}\nclass MyLogic {\n  hubAfter(cmd) {\n    if (cmd.is('ChildLogic.SomeCommand')) {\n      // by command name\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand)) {\n      // by command factory\n    }\n    if (cmd.is(logicOf(this.model.child).SomeCommand)) {\n      // by binded to a concrete model command factory (commands\n      // binded for other models will be ignored)\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand, this.model.child)) {\n      // by command factory and concrete child model (commands\n      // binded for other models will be ignored)\n    }\n  }\n}\n```\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the command have same name, or same origin function\n                                and binded to same model (if second argument provided)\n\n##### appendArgs\n\nCreates a new Command instance (clone the command) and append\ngiven list of arguments to the current list of arguments.\nReturns a new Command with new list of arguments.\n\n**Parameters**\n\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of arguments that will be appened\n                               to tne new Command\n\nReturns **[Command](#command)** New command with appended arguments\n\n##### bind\n\nCreates a new Command instance and set given logic instance in it.\nAlso update command name by name of the origin function and name\nof the logic class.\n\n**Parameters**\n\n-   `logic` **[LogicBase](#logicbase)** A logic instance that should be binded to a command\n\nReturns **[Command](#command)** New command binded to given logic instance\n\n#### TaskMeta\n\nClass for declaring an async task. An instance of this object returned\nfrom [taks](taks) function.\n\nA task function is a function that could return a Promise. The resolved value\nwill be passed to a success command handler, the rejected command will be passed\nto a fail command handler.\n\nIf task function do not return a Promise, then the returned value passed to a\nsuccess command, and if the function throw an error then the error passed to\na fail command.\n\nThe task function receive at least one argument – an object with `model`, `shared`\nand `meta`. All the next arguments will be given from a command that returned a task,\nif it is not overrided by [TaskMeta#args](#taskmetaargs)\n\nBy default a task is single-threaded. It means that every call to a task will cancel\npreviously running task if it is running. You can make the task to be multi-threaded\nby [TaskMeta#multithread](#taskmetamultithread), so every call to a task won't cancel the running one.\n\nIn a context of the task function defined special `call` function. This function should\nbe used to invoke sub-tasks. It is important to use `call` to run sub-tasks because\n`call` create a cancellation point of the task – if the task cancelled, then nothing\nwill be executed after currently running `call` sub-task.\n\n`call` returns an object with `result` and `error` fields. If `error` field is not\nempty, then something weird happened in the sub-task. `call` internally have a try/catch,\nso it is not necessary to wrap it with try/catch, just check the `error` field in the\nreturned object and if it is not empty – handle it somehow (throw it, or do any custom\nerror handling)\n\nAlso in a context of the task defined a `notify` function. It is a function that execute\nnotify command if it is defined. The command executed with the same arguments as passed\nto `notify` function. You can use it to incrementally update a model while the long\ntask is executing, to show some progress for the user.\n\n**Parameters**\n\n-   `taskFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `executor` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nasync function SubTask(a, b, c) {\n  this.notify(a + b + c);\n  await this.call(delay, 100);\n  return (a / b * c);\n}\nasync function RootTask({ model }) {\n  const { result, error } = await this.call(SubTask, 1, 0, 3);\n  if (error) {\n    throw new Error('Something weird happened in subtask')\n  }\n  return result + 10;\n}\n```\n\n```javascript\nclass MyLogic {\n  \\@cmd AsyncCommand() {\n    return task(Tasks.RootTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n      .notify(this.NotifyCommand)\n  }\n}\n```\n\n##### notify\n\nSet a notify handler command. This command executed by call of `this.notify`\ninside a task with the same arguments as passed to `this.notify`\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### success\n\nSet a success handler command. Will be executed with a value returned\nfrom the task, or if the task returned a Promise – with resovled value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### fail\n\nSet a fail handler command. Will be executed with error throwed in the task,\nor if the task returned a Promise – with rejected value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### multithread\n\nDefine the task to be \"multi-thread\", so every call\nwill run in parallel with other calls of the same task\nin scope of one process (model).\n\n**Parameters**\n\n-   `val` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### engine\n\nSet task executor function. The executor function should return an object\nthat should have at least two fields: `exec` and `cancel` functions.\n`exec` should return a promise which should be resolved or rejected\nwith an object `{ result, error }`. A `cancel` function should stop\nthe task execution.\n\n**Parameters**\n\n-   `engine` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that returns\n                               `{ exec: Function, cancel: Function }` object\n\nReturns **[TaskMeta](#taskmeta)** \n\n##### args\n\nOverride arguments which will be passed to the task\nstarting from second argument. By default a task will receive\nthe same set of arguments as a task command. If this function invoked,\nthen the task will receive given arguments instead of command arguments.\n\n**Parameters**\n\n-   `args` **...any** \n\nReturns **[TaskMeta](#taskmeta)** \n\n#### DefaultLogger\n\nA class which defins a logger for tracking command execution process.\nThe default implmenetation just defines all possible logger\nmethods (log points) and print errors to the console.\nExtend this class to define your own logging functionality\n(like logging errors with Setnry or Loggly)\n\n**Examples**\n\n```javascript\n// ./index.js\nimport { DefaultLogger, run } from 'mangojuice-core';\nimport MainBlock from './blocks/MainBlock';\n\n// Implement custom logger\nclass SetnryLogger extends DefaultLogger {\n  onCatchError(error, cmd) {\n    Raven.catchException(error);\n  }\n}\n\n// Pass instance of the Logger to `run` options object.\nrun(MainBlock, { logger: new SetnryLogger() });\n```\n\n##### onStartExec\n\nThis method invoked right before anything else - as the first thing\nin [Process#exec](#processexec). Even before any [LogicBase#hubBefore](#logicbasehubbefore).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that just started execution process\n\n##### onStartHandling\n\nInvoked right before command will go through all [LogicBase#hubBefore](#logicbasehubbefore) or [LogicBase#hubAfter](#logicbasehubafter)\nup in the blocks tree. The second argument indicates is it called for [LogicBase#hubBefore](#logicbasehubbefore)\nor for [LogicBase#hubAfter](#logicbasehubafter).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that is going to go through hubs in parent blocks\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command is going through \"after\" hubs, \"before\" otherwise\n\n##### onEndHandling\n\nInvoked when the command went through all hubs and when all sync commands\nreturned from hubs was executed.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that went through all hubs\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command going through \"after\" hubs, \"before\" otherwise\n\n##### onExecuted\n\nInvoked when the command function executed and the return of the function processed –\nall returned commands executed, all async tasks started, the model updated.\nBut it invoked before the command go through \"after\" hubs.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was exectued and the return processed\n-   `result` **any** Returned object from the command's function\n\n##### onEndExec\n\nInvoked right after the command go throught \"after\" hubs. It is the final\nstage of command execution.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was fully executed and handled by parent blocks\n\n##### onCatchError\n\nInvoked if any uncaught error happened while execution of the command\nor anywhere else in the logic, like in [LogicBase#port](#logicbaseport) or in [LogicBase#computed](#logicbasecomputed).\nBy default print the error using `console.error`.\n\n**Parameters**\n\n-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** The error instance\n-   `cmd` **[Command](#command)?** Command that was executing while the error happened\n\n#### ComputedField\n\nClass for declaring computed field with model dependencies.\nGiven array shuold contain models, binded to some\nlogec. They will be passed to compute function in the same order.\nAlso they will be used to track changed and re-compute.\n\nThe class is immutable, so any call to any method will create\na new instance of `ComputedField` and the old one won't be touched.\n\n**Parameters**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** \n\n**Properties**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** An array of models with binded logic\n                                    (attached some [Process](#process))\n-   `computeFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that will be used\n                                    to compute value of the computed field.\n\n##### compute\n\nCreates a new instance of the field and set compute function in it.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that should return a value that\n                             will be used as a value for some computed field in\n                             a model. This function will be invoked with all\n                             dependency models as arguments\n\n**Examples**\n\n```javascript\n// A way to override computed field of some base logic class\n// (thanks to immutability of `ComputedField`)\nclass MyLogic extends SomeOtherLogic {\n  computed() {\n    const oldComputed = super.computed();\n    return {\n      ...oldComputed,\n\n      // Override `oldField` compute function with saved dependencies\n      // and use overrided compute function inside new compute function\n      oldField: oldComputed.compute((...deps) => {\n        return 1 > 0 || oldComputed.oldField.computeFn(...deps);\n      })\n    };\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** New instance of the ComputedField with `computeFn`\n                         set to given function.\n\n#### Mounter\n\nTo use [mount](#mount) function you need to implement a Mounter interface\nwhich should have `mount` and `unmount` functions. It is up to the developer\nhow these functions will be implemented and what view library they will use.\n\nThere is a rule that mounter and view library should follow: view of\na model should be updated only when the model updated and the update\nshouldn't touch views of children models (children views shouldn't be updated\nbecause their models is not changed).\n\nReact perfectly fits for this rule. By implementing `shuoldComponentUpdate`\nyou can control when the component should be updated and when shouldn't. In this\ncase this function should always return `false` and componenent should be\nupdated using `forceUpdate` only when the model is updated (using [observe](#observe)).\n\n**Properties**\n\n-   `mount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that should expect two arguments: model object with\n                                  attached [Process](#process) instance and [Block#View](Block#View).\n                                  It should render the model using given View (somehow).\n-   `unmount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuold unmount mounted view from DOM.\n\n**Examples**\n\n```javascript\n// Minimal react mounter which follow the rules\nclass ViewWrapper extends React.Component {\n  componentDidMount() {\n    const { model } = this.props;\n    this.stopObserver = observe(model, () => this.forceUpdate())\n  }\n  componentWillUnmount() {\n    this.stopObserver();\n  }\n  shouldComponentUpdate() {\n    return false;\n  }\n  render() {\n    const { View, model } = this.props;\n    const Logic = logicOf(model);\n    return <View model={model} Logic={Logic} />\n  }\n}\nclass ReactMounter {\n  mount(model, View) {\n    return React.render(\n      <ViewWrapper View={View} model={model} />,\n      document.querySelector('#container')\n    );\n  }\n  unmount() {\n    return React.unmountComponentAtNode(\n      document.querySelector('#container')\n    );\n  }\n}\n```\n\n#### defineCommand\n\nProvides a way to define a command in the prototype without\nusign a decorator. You should give a prototype of the logic class,\nname of the function which should be converted to a command factory\nand the decorator function (optional).\n\nIf the decorator function is not provided, then [cmd](#cmd) will be used\nby default.\n\n**Parameters**\n\n-   `proto` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Logic class prototype\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Method name that you want to convert to a command factory\n-   `decorator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** Optional decorator function\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n  // throttle 100\n  ThrottledCommand() {\n    return this.SomeCommand();\n  }\n}\n\ndefineCommand(MyLogic.prototype, 'SomeCommand');\ndefineCommand(MyLogic.prototype, 'ThrottledCommand', cmd({ throttle: 100 }));\n```\n\n#### ensureCommand\n\nReturns a [Command](#command) instance or throw an error if given\nargument can't be used to create a [Command](#command) (is not a Command\nor command factory).\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** [Command](#command) instance or command factory. When\n                                     command factory then it will be invoked with\n                                     no arguments to create a command\n\n**Examples**\n\n```javascript\nclass MyLogic() {\n  \\@cmd SomeCommand() {\n    // do something\n  }\n}\n\nconst logic = new MyLogic();\nensureCommand(logic.SomeCommand) // returns Command instance\n// equals to...\nlogic.SomeCommand()\n```\n\nReturns **[Command](#command)** \n\n#### decorateLogic\n\nBy given logic class go through prototypes chain and\ndecorate all cmd functions. Use it if you can't use decorators\nin your project\n\nIt determine that the function should be converted to a command\nfactory (decorated by [cmd](#cmd)) by its name. If the function\nstarts with uppercase letter or underscore+upper-letter, then it\nis considered as a command.\n\n**Parameters**\n\n-   `LogicClass` **[LogicBase](#logicbase)** Logic class that you want to decorate\n-   `deep` **bool** If true then it will go though prototypes chain and\n                        decorate every prototype in the chain.\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n  }\n  _SomePrivateCommand() {\n  }\n  notACommand() {\n    return 123;\n  }\n}\n\n// `SomeCommand` and `_SomePrivateCommand` will be decorated with `cmd`\n// (the prorotype will be changed in-place). `notACommand` won't\n// be decorated.\ndecorateLogic(MyLogic);\n\nconst logic = new MyLogic();\nlogic.SomeCommand() // returns Command instance\nlogic._SomePrivateCommand() // returns Command instance\nlogic.notACommand() // returns 123\n```\n\n#### handleBefore\n\nFunction adds a handler to the [Process](#process) attached to a given\nmodel that will be invoked before every command running for this\nmodel. The handler won't be invoked for commands from children\nmodels of given model.\n\nReturns a function that removes the handler from the Process\n(stop handling)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called before every own command\n\n**Examples**\n\n```javascript\nimport { handleBefore, run, logicOf } from 'mangojuice-core';\n\n// Define root and child logic\nclass ChildLogic {\n  \\@cmd ChildCommand() {}\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  \\@cmd RootCommand() {}\n}\n\n// Run block with empty models\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ childModel: {} })\n});\n\n// Adds a handler to a root model\nhandleBefore(res.model, (cmd) => console.log(cmd));\n\n// Run commands on root and child models\nres.proc.exec(logicOf(res.model).RootCommand);\nres.proc.exec(logicOf(res.model.childModel).ChildCommand);\n\n// In the console will be printed only `RootCommand` command object\n// right before the command will be executed\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### handleAfter\n\nIt is the same as [handleBefore](#handlebefore) but the handler will be invoked\n**after** every own command.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### handle\n\nAlias for [handleAfter](#handleafter)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### logicOf\n\nReturns a Logic instance attached to a given model object. The logic\ninstance stored in attached [Process](#process) instance, so it execute\n[procOf](#procof) for the model to get a [Process](#process) instance and then\nget the logic instance form a Process and return it.\n\nIf Process is not attached to the model, then an Error will be throwed.\nIf the second argument passed then it will also check that the logic\ninstance is instance of some particular class.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `logicClass` **Class?** Optional logic class to check that the logic\n                                  instance is instance of the class\n\nReturns **[LogicBase](#logicbase)** Returns a logic instance\n\n#### observe\n\nA function that adds a handler to the [Process](#process) instance attached\nto a given model, that will be invoked on every command that changed\nthe model. Useful for tracking changes to re-render a view of the model.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process) instance\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be invoked after every command\n                                that changed the model.\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object with options\n    -   `options.batched` **bool** If true then the handler will be invoked only when\n                                        the commands stack is empty and model was changed during\n                                        the stack execution. Useful to reduce amount of not necessary\n                                        view re-renderings.\n\n**Examples**\n\n```javascript\nimport { run, cmd, observe, logicOf } from 'mangojuice-core';\n\nclass MyLogic {\n  \\@cmd MultipleUpdates() {\n    return [\n      this.UpdateOne,\n      this.UpdateTwo\n    ];\n  }\n  \\@cmd UpdateOne() {\n    return { one: this.model.one + 1 };\n  }\n  \\@cmd UpdateTwo() {\n    return { two: this.model.two + 1 };\n  }\n}\n\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ one: 1, two: 1 })\n});\n\nobserve(res.model, () => console.log('not-batched'));\nobserve(res.model, () => console.log('batched'), { batched: true });\n\nres.proc.exec(logicOf(res.model).MultipleUpdates);\n\n// `not-batched` will be printed two times\n// `batched` will be printed only once\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n#### procOf\n\nGet a [Process](#process) instance attached to the given model object.\nInternally it get a `__proc` field from the given model and returns it.\n\nIf given model do not have attached Process, then an Error will be throwed,\nbut only if the second argument is not true, which ignores the error.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `ignoreError` **bool** If true then no error will be throwed if Process\n                               is not attached to the model\n\nReturns **[Process](#process)** An instance of [Process](#process) attached to the model\n\n#### bind\n\nThis function do the following:\n\n-   Creates a model object using [Block#createModel](Block#createModel). It is invoked without\n    arguments.\n-   Create a [Process](#process) instance with logic from [Block#Logic](Block#Logic)\n-   Call [Process#bind](#processbind) with created model\n\nReturns an object with created process instance, model object and given block.\nUsefull when you want to prepare the block to run but you want to run it manually.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A [Block](#block) object\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options object that could change [Process](#process) behaviour (optional, default `{}`)\n    -   `opts.logger` **[DefaultLogger](#defaultlogger)?** A custom logger instance that will be used in the\n                                               Process to track commands execution. By default\n                                               [DefaultLogger](#defaultlogger) will be used.\n    -   `opts.shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object that will be available in any logic in the\n                                          tree as `this.shared`. Could be anything you want, but\n                                          you will get more benifites if you will pass model object\n                                          with attached Process as shared object to be able to make\n                                          computed fields with depending of shared model.\n    -   `opts.args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>?** An array of arguments that will be passed to [LogicBase#config](#logicbaseconfig)\n                                               of the logic.\n    -   `opts.Process` **[Process](#process)?** A class that will be used instead of [Process](#process). By default\n                                          general [Process](#process) is used, but you can customize it for your\n                                          specific needs and pass here. Then every other process in the tree\n                                          will be an instance of this custom [Process](#process) implementation\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block)}** An object with [Process](#process) instance, model object and block that was passed to\n   the function\n\n#### hydrate\n\nThis function replace a `createModel` function in given block\nwith new function that just returns a given model. It is useful\nwhen you have some old model and just want to run everytihing with\nit (for example for server rendering, or hot module replacement)\n\n**Parameters**\n\n-   `block` **[Block](#block)** An original block\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to use\n\n**Examples**\n\n```javascript\n// Hot module replacement example\nimport MyBlock from './MyBlock';\nimport { hydrate, run } from 'mangojuice-core';\n\n// Run initial block\nlet res = run(MyBlock);\n\n// When block changed destroy the old process, hydrate a new\n// block with existing model and run hydrated new block again\nmodule.hot.accept(['./MyBlock'], () => {\n  res.proc.destroy();\n  const newBlock = hydrate(require('./MyBlock'), res.model);\n  res = run(newBlock);\n});\n```\n\nReturns **[Block](#block)** A new block with replaced `createModel` function\n                 which just returns a model that you passed as\n                 second argument.\n\n#### delay\n\nA helper function for delaying execution. Returns a Promise\nwhich will be resolved in given amount of milliseconds. You can\nuse it in [task](#task) to implement some delay in execution, for\ndebouncing for example.\n\n**Parameters**\n\n-   `ms` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** An amount of milliseconds to wait\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that resolved after given amount of milliseconds\n\n## Basic\n\nThe most common APIs that you will work with most of the time\n\n### Block\n\nBlock is a top level component in MangoJuice which consists of three parts:\n\n-   Model factory function `createModel` which should return a plain object.\n    The main requirement for this function is that it should be able to return\n    some model with zero arguments. But it can also accept some arguments\n    as well.\n-   A logic class which implements [LogicBase](#logicbase) interface\n-   A View function which is aimed to render the model created by `createModel`\n\nThe View part is optional and it could have different type depending on\nselected View library to render a model and particular binding library.\n\n**Properties**\n\n-   `Logic` **[LogicBase](#logicbase)** A logic class that should be attached to the model.\n-   `createModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuld return a plain object which\n                                      will be an init model of the block.\n-   `View` **any?** Something that some particular view library can render\n\n**Examples**\n\n```javascript\n// You can define block in short way using an object\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nrun(MyBlock);\n```\n\n```javascript\n// Or you can split it with modules (recommended)\n// ./MyBlock/index.js\nimport Logic from './Logic';\nimport View from './View';\nimport { createModel } from './Model';\nexport default { View, Logic, createModel };\nexport { View, Logic, createModel };\nexport type { Model } from './Model';\n\n// ./MyBlock/Logic.js\nimport type { Model } from './Model';\nimport { LogicBase, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  \\@cmd SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n}\n\n// ./MyBlock/Model.js\nexport type Model = { field: number };\nexport const createModel = () => ({\n  field: 1\n});\n\n// ./MyBlock/View.js\nconst MyBlockView = ({ model }) => (\n  <div>{model.field}</div>\n);\nexport default MyBlockView;\n\n// ./index.js\nimport MyBlock from './MyBlock';\nimport { run } from 'mangojuice-core';\n\nrun(MyBlock);\n```\n\n### LogicBase\n\nBasic class for every logic. It is not necessaty to inherit an actual logic\nclass from it, but for better type-checking it could be really usefull.\n\nLogic class defines:\n\n-   A set of commands that could change an associated model – methods decorated with [cmd](#cmd)\n-   What fields of the model should be associated with which logic class\n    (children blocks) – [LogicBase#children](#logicbasechildren) method\n-   A set of computed model fields – [LogicBase#computed](#logicbasecomputed) method\n-   A set of rules to handle commands from children logic – [LogicBase#hubAfter](#logicbasehubafter)\n    and [LogicBase#hubBefore](#logicbasehubbefore) methods\n-   A logic to handle external events – [LogicBase#port](#logicbaseport) method.\n\nThe logic class defines all the business-logic of some part of your application.\nThe main goal of the logic – change associated model. Check [cmd](#cmd) and [Process#exec](#processexec)\nto have a better understanding how command can be defined and how it is executed.\n\n**Properties**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object which is associated with the\n                               logic class in parent logic.\n-   `meta` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object defined in [LogicBase#config](#logicbaseconfig) method for storing\n                               some internal logic state.\n-   `shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object with some shared state, defined while\n                               run process of the app.\n\n**Examples**\n\n```javascript\n// ./blocks/MyBlock/Logic.js\n// @flow\nimport type { Model } from './Model';\nimport ChildBlock from '../ChildBlock';\nimport { Command, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  children() {\n    return { child: ChildBlock.Logic };\n  }\n  hubAfter(cmd: Command) {\n    if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n      return this.TestCommand(123);\n    }\n  }\n  \\@cmd TestCommand(arg) {\n    return { field: arg + this.model.field };\n  }\n}\n```\n\n#### config\n\nA function that defines init commands and meta object of the\nlogic. Can accept any type and number of arguments. Config\nwill take arguments passed to [child](#child) function (for example\n`child(MyLogic, 1, 2, 3)` defines that the `config` method of\n`MyLogic` will be invoked like `config(1, 2, 3)`)\n\nCould return an object with the fields:\n\n-   `initCommands` which could be an array or a single Command,\n    that will be executed every time when the logic instance created\n    and associated with some model (when [Process#run](#processrun) invoked)\n-   `meta` which could be an object with some internal state of\n    the logic\n\n**Examples**\n\n```javascript\nconfig(props) {\n  return {\n    initCommands: [ this.StartThis, this.SendThat(123) ],\n    meta: { something: props.amount }\n  };\n}\n```\n\n#### children\n\nThis function defines what logic class should be associated\nwith which model field. Should return an object where a key is\na model field name, and a value is a logic class or an object\nthat defines logic with arguments (return from [child](#child) function)\n\n**Examples**\n\n```javascript\nchildren() {\n  return {\n    searchForm: child(SearchForm.Logic, { timeout: 100 }),\n    searchResults: SearchResults.Logic\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n#### computed\n\nShould return an object which defines computed fields of the model.\nA key of the object is a model field, and value is a function or\ncomputed function definition object (return from [depends](#depends) function).\n\nComputed field is lazy, which means that it is computed on the first use\nof the field and the computation result cached until the next update\nof the model.\n\nIf you want to define a computed field which ueses in computation not\nonly fields from the own model, but maybe some values from child model,\nor from shared model, then you will need to use [depends](#depends) function to\ndefine what models used while computation to observe changes of these\nmodels to trigger an update event of the own model (to update views).\n\n**Examples**\n\n```javascript\ncomputed() {\n  return {\n    simple: () => this.model.a + this.model.b,\n    withDeps: depends(this.model.child, this.shared).compute(() => {\n      return this.model.child.a + this.shared.b + this.model.c;\n    })\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n#### port\n\nA function to handle global event, such as browser-level events,\nwebsocket, intervals. The main porpouse of the `port` is to subscribe\nto some global events, execute appropriate commands from the logic\non the events and remove the handlers when the logic was destroyed.\n\n**Parameters**\n\n-   `exec` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** It is a function that execute a passed command\n-   `destroyed` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that will be resolved when the logic destroyed\n\n**Examples**\n\n```javascript\nport(exec, destroyed) {\n  const timer = setInterval(() => {\n    exec(this.SecondPassed);\n  }, 1000);\n  destroyed.then(() => clearInterval(timer));\n}\n```\n\n#### hubAfter\n\nHub for all commands executed in the children blocks. The only\narguments is a command object that was executed.\nCould return a Command or an array of Commands that should\nbe executed next.\nMost of the time this function will look like a `switch`,\nbut maybe with some additional rules for the cases. Take a look\nto [Command#is](#commandis) function to have a better understanding how you\ncan determine that the command is exactly what you are waiting for.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was executed in some child logic\n                           or in any child of the child and so on down to\n                           the leaf of the tree.\n\n**Examples**\n\n```javascript\nhubAfter(cmd) {\n  if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n    return this.HandlerCommand(123);\n  }\n  if (cmd.is('AnotherChild.SomeAnothercommand')) {\n    return [ this.HandlerCommand(321), this.AnotherHandler ];\n  }\n}\n```\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)**\n\n#### hubBefore\n\nSame as [LogicBase#hubAfter](#logicbasehubafter), but catch commands before\nit will be actually executed, so you can compare prev and next\nmodel state for example.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)**\n\n### cmd\n\nDecorator that converts a logic method to a command factory.\nThe result function (command factory function) is a function\nthat return a [Command](#command) instnace with the decorated function\nand arguments that you will pass to a command factory function.\n\nYou can use this decorator without arguments or with an options\nargument (object)\n\nCheck [Process#exec](#processexec) to see what the origin function\ncould return to do something. If in short, it can return:\nnothing, command (or factory or array of commands), task,\nmodel update object.\n\n**Parameters**\n\n-   `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** If only this argument passed then it will be considered\n                                   as options object which can customize command behaviour.\n    -   `obj.debounce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be debounced by given amount of\n                                       milliseconds\n    -   `obj.throttle` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be throttled by given amount of\n                                       milliseconds\n    -   `obj.noInitCall` **bool** If true then debounced/throttled execution\n                                       won't start with init command call. By default\n                                       debounced/throttled command will be instantly\n                                       exected and only then wait for a chance to execute\n                                       again. With `noInitCall=true` there is no instant init\n                                       command call.\n    -   `obj.internal` **bool** Make the command invisible for parent [LogicBase#hubBefore](#logicbasehubbefore)\n                                       and [LogicBase#hubAfter](#logicbasehubafter). Use it for commands that shouldn't\n                                       be handled by hubs to increse performance.\n    -   `obj.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** By default name of the command taken from origin function. With this\n                                       option you can override the name with any other value.\n-   `methodName`\n-   `descr`\n\n**Examples**\n\n```javascript\nclass RegularLogic {\n  \\@cmd RegularCommand() {\n    // do something\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ debounce: 300 })\n  DebouncedCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 600ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300 })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300, noInitCall: true })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 1 time in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ internal: true })\n  _InternalCommand() {\n    // this command can't be caught in `hubBefore` or `hubAfter`\n    // in parent logics. Use it carefully.\n  }\n}\n```\n\nReturns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory function (if all three arguemnts passed)\n                               or a decorator function with binded options object\n                               (that you pass as a first argument)\n\n### run\n\nRun given block. It is a short-hand function for running [bind](#bind)\nand then running a Process by [Process#run](#processrun).\nAlso it returns an additional `finished` Promise which is resolved\nwhen all async tasks finished and all handler commands executed.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A block that you wan to run\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Same options as in [bind](#bind) (optional, default `{}`)\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block), finished: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)}** An object\n                 which is almost the same as returned from [bind](#bind), but with\n                 additional `finished` field, which is a Promise that will be resolved\n                 when all blocks will execute all commands and all async tasks will be\n                 finished.\n\n### mount\n\nMount running block. As third and next arguments you can pass other running\nblocks which will be stopped with the main running block (useful for HMR).\n\n**Parameters**\n\n-   `mounter` **[Mounter](#mounter)** An implementation of [Mounter](#mounter) interface\n-   `runRes` **{proc: [Process](#process), block: [Block](#block), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}** An object that returned\n                     from [run](#run) function.\n-   `otherBlocks` **...any**\n\n**Examples**\n\n```javascript\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nmount(new ReactMounter(), run(MyBlock));\n```\n\nReturns **{view: any, stop: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)}** An object with the result form [Mounter#mount](Mounter#mount)\n                 function (in `view` field) and stop function which destroy the process and\n                 unmount a view using [Mounter#unmount](Mounter#unmount)\n\n### task\n\nCreates a [TaskMeta](#taskmeta) object that could be returned from\nasync task command. It describes the task that should be executed.\n\nFor more information what the **Task** is and how it should be implemented\ntake a look to [TaskMeta](#taskmeta).\n\n**Parameters**\n\n-   `taskFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that could return a Promise\n\n**Properties**\n\n-   `CANCEL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A symbol that you can use to make a promise \"cancellable\"\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n### cancel\n\nThis function should be used to cancel async [task](#task) execution.\nAlso it can cancel the debounced/throttled command.\n\n-   In case with task, if task was executing while you call a cancel command,\n    the task will be cancelled (execution stopped). Otherwise nothing will happen.\n-   In case with debounced/throttled command, if the command scheduled to be executed\n    then the schedule timer will be cleared and the command won't be executed.\n    If the command is not scheduled then nothing happens.\n\nTo use it just pass a command or command factory as a first argument\nand return it from some other command.\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Command or command factory that you wan to cancel. Could\n                                    be a command that returns [task](#task) or debounced/throttled\n                                    command\n\n**Examples**\n\n```javascript\nclass SomeLogic {\n  \\@cmd CancelSomethingCommand() {\n    return [\n      cancel(this.TaskCommand),\n      cancel(this.DebounceCommand)\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask);\n  }\n  \\@cmd({ debounce: 300 })\n  DebounceCommand() {\n    // do something\n  }\n}\n```\n\nReturns **[Command](#command)** Returns a new command that will cancel the execution of the command\n                  passed as an argument.\n\n### child\n\nCreates an object which describes child logic which will be attached\nto some model field. Should be used in [LogicBase#children](#logicbasechildren) to\ndefine a logic that should be instantiated with some arguments passed\nto [LogicBase#config](#logicbaseconfig).\n\n**Parameters**\n\n-   `logicClass` **[LogicBase](#logicbase)** Class that imlements [LogicBase](#logicbase) interface\n-   `args` **...any**\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  config(amount) {\n    return { meta: { amount } };\n  }\n}\nclass RootLogic {\n  children() {\n    return {\n      modelField: child(ChildLogic, 10)\n      // `config` of `ChildLogic` will be invoked with\n      // `10` as a first argument\n    }\n  }\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object that contains a logic class and an arguments array that\n                 should be used to invoke `config` method of provided logic class.\n\n### depends\n\nFunction that helps to describe a computed field with external\nmodel dependncies. Should be used in [LogicBase#computed](#logicbasecomputed).\nIt creates an instance of [ComputedField](#computedfield) with dependencies\npassed as arguments.\n\nA compute field with external dependencies is a field that should\nbe updated (re-computed) not only when the own model udpated, but\nalso when depdendency models updated.\n\n**Parameters**\n\n-   `deps` **...deps** A list of models with attached logic\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  // some logic\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  computed() {\n    return {\n      // depends on `childModel`\n      computedField: depends(this.model.childModel).compute(() => {\n        return this.model.a + this.model.childModel.b;\n      }),\n\n      // depends on `shared` model\n      computeWithShared: depends(this.shared).compute(() => {\n        return this.model.b + this.shared.someField;\n      })\n    }\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)**\n\n## Extras\n\nOther pieces of MangoJuice\n\n### Process\n\nThe main class of MangoJuice that ties model, logic and view together.\n\nIt works in the following way:\n\n-   You create a model for your app (object) using `createModel` of\n    the root block. The result is a plain object.\n-   Then you need to create an instance of Process and pass logic class\n    in the options object.\n-   Then you `bind` the Process instance to the model object you created on step one.\n    \"To bind Process to a model\" means that in the model will be created a hidden\n    field `__proc` with a reference to the Process instance.\n-   After that you can `run` the Process, which will execute init commands, port.\n\n`bind` and `run` also look at the object returned from [LogicBase#children](#logicbasechildren)\nand create/run Process instances for children models.\n\nMost of the time you do not need to care about all of these and just use\n[run](#run) and [mount](#mount). These small functions do everything described\nabove for you.\n\n**Examples**\n\n```javascript\nimport { Process, logicOf } from 'mangojuice-core';\n\nconst ExampleBlock = {\n  createModel() {\n    return { a: 10 };\n  },\n  Logic: class Example {\n    \\@cmd Increment(amount = 1) {\n      return { a: this.model.a + amount };\n    }\n  }\n};\n\nconst model = ExampleBlock.createModel();\nconst proc = new Process({ logic: ExampleBlock.Logic });\nproc.bind(model);\nproc.run();\nproc.exec(logicOf(model).Increment(23));\n```\n\n#### bind\n\nBind the process instance to a given model, which means that hidden\n`__proc` field will be created in the model with a reference to the\nProcess instance.\n\nAlso bind all children models – go through children definition returned\nby [LogicBase#children](#logicbasechildren), create Process for each child and bind\nit to an appropreat child model object.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to bind to the Process.\n\n#### run\n\nRun the process – run children processes, then run port and\ninit commands defined in config.\nAlso run all model observers created by [observe](#observe)\n\n#### destroy\n\nDestroy the process with unbinding from the model and cleaning\nup all the parts of the process (stop ports, computed fields).\n`__proc` field will be removed from the model object and all\nchildren objects.\n\n**Parameters**\n\n-   `deep` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then all children blocks will be destroyed.\n                             By default, if not provided then considered as true.\n\n#### exec\n\nExec a command in scope of the Process instance.\nIt will use binded model and logic object to run the\ncommand. The command could be function (command factory)\nor object ([Command](#command) instance).\n\nA command origin function could return three types of things:\n\n-   Another [Command](#command)/command factory or an array of commands\n    (an element of the array also could be another array with commands\n    or null/undefined/false). All commands will be execute in provided order.\n-   An instance of [TaskMeta](#taskmeta) (which is usually created by [task](#task)\n    helper function). The returned task will be started and do not block\n    execution of next commands in the stack.\n-   A plain object which is a model update object. The object will be merged\n    with current model.\n\nIf command is undefined or `Process` instance not binded\nto any model it will do nothing.\n\n**Parameters**\n\n-   `cmd` **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory or Command instance\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  \\@cmd BatchCommand() {\n    return [\n      1 > 2 && this.SomeCoomand,\n      this.AnotheCommand(123),\n      2 > 1 && [\n        this.AndSomeOtherCommand,\n        this.FinalCommand()\n      ]\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n  }\n  \\@cmd ModelUpdateCommand() {\n    if (Math.random() > 0.6) {\n      return { field: Date.now() };\n    }\n  }\n}\n```\n\n#### finished\n\nReturns a promise which will be resolved when all async\ntasks and related handlers in the process and all children\nprocesses will be finished.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**\n\n### Command\n\nClass which declares a command that will be executed in the\nfuture by some [Process#exec](#processexec). It contains a function that will be\nexecuted, arguments that should be passed to the function\nand command name.\n\nThe command also keep a context that should be used to execute\na function. Usually this context is some logic instance. You\ncan bind a context to the command using [Command#bind](#commandbind) function.\n\nThe command instance is immutable, so any function that\nmakes some change in the command will produce a new command\ninstead of changing the original one.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>**\n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n\n**Properties**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** An origin function that should be executed\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** A set of arguments that should be used\n                                 to execute the fucntion.\n\n#### exec\n\nExecute a function stored in the command instance. It passes\nstored arguments to the function and call it in stored context.\nReturns the value that was returned form the function.\n\nReturns **any**\n\n#### clone\n\nClone instance of the command\n\nReturns **[Command](#command)**\n\n#### is\n\nCheck is the command equal to some other command or have\na reference to the same origin function. Optionally you can also\ncheck that the command binded to some concrete model (using\nthe second argument).\n\nYou can use many different formats to define the command to check:\n\n-   Just a string, which should be constructed like\n    `Logic Class Name + Function Name`\n-   Command object or command factory that you can get from prorotype\n    of some logic class.\n-   Binded command object or command factory that you can get from\n    concrete model using [logicOf](#logicof) function\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Command object or command factory or command name\n-   `childModel` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Model object that should be binded to the command (optional)\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  \\@cmd SomeCommand() {}\n}\nclass MyLogic {\n  hubAfter(cmd) {\n    if (cmd.is('ChildLogic.SomeCommand')) {\n      // by command name\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand)) {\n      // by command factory\n    }\n    if (cmd.is(logicOf(this.model.child).SomeCommand)) {\n      // by binded to a concrete model command factory (commands\n      // binded for other models will be ignored)\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand, this.model.child)) {\n      // by command factory and concrete child model (commands\n      // binded for other models will be ignored)\n    }\n  }\n}\n```\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the command have same name, or same origin function\n                                and binded to same model (if second argument provided)\n\n#### appendArgs\n\nCreates a new Command instance (clone the command) and append\ngiven list of arguments to the current list of arguments.\nReturns a new Command with new list of arguments.\n\n**Parameters**\n\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of arguments that will be appened\n                               to tne new Command\n\nReturns **[Command](#command)** New command with appended arguments\n\n#### bind\n\nCreates a new Command instance and set given logic instance in it.\nAlso update command name by name of the origin function and name\nof the logic class.\n\n**Parameters**\n\n-   `logic` **[LogicBase](#logicbase)** A logic instance that should be binded to a command\n\nReturns **[Command](#command)** New command binded to given logic instance\n\n### TaskMeta\n\nClass for declaring an async task. An instance of this object returned\nfrom [taks](taks) function.\n\nA task function is a function that could return a Promise. The resolved value\nwill be passed to a success command handler, the rejected command will be passed\nto a fail command handler.\n\nIf task function do not return a Promise, then the returned value passed to a\nsuccess command, and if the function throw an error then the error passed to\na fail command.\n\nThe task function receive at least one argument – an object with `model`, `shared`\nand `meta`. All the next arguments will be given from a command that returned a task,\nif it is not overrided by [TaskMeta#args](#taskmetaargs)\n\nBy default a task is single-threaded. It means that every call to a task will cancel\npreviously running task if it is running. You can make the task to be multi-threaded\nby [TaskMeta#multithread](#taskmetamultithread), so every call to a task won't cancel the running one.\n\nIn a context of the task function defined special `call` function. This function should\nbe used to invoke sub-tasks. It is important to use `call` to run sub-tasks because\n`call` create a cancellation point of the task – if the task cancelled, then nothing\nwill be executed after currently running `call` sub-task.\n\n`call` returns an object with `result` and `error` fields. If `error` field is not\nempty, then something weird happened in the sub-task. `call` internally have a try/catch,\nso it is not necessary to wrap it with try/catch, just check the `error` field in the\nreturned object and if it is not empty – handle it somehow (throw it, or do any custom\nerror handling)\n\nAlso in a context of the task defined a `notify` function. It is a function that execute\nnotify command if it is defined. The command executed with the same arguments as passed\nto `notify` function. You can use it to incrementally update a model while the long\ntask is executing, to show some progress for the user.\n\n**Parameters**\n\n-   `taskFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n-   `executor` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n\n**Examples**\n\n```javascript\nasync function SubTask(a, b, c) {\n  this.notify(a + b + c);\n  await this.call(delay, 100);\n  return (a / b * c);\n}\nasync function RootTask({ model }) {\n  const { result, error } = await this.call(SubTask, 1, 0, 3);\n  if (error) {\n    throw new Error('Something weird happened in subtask')\n  }\n  return result + 10;\n}\n```\n\n```javascript\nclass MyLogic {\n  \\@cmd AsyncCommand() {\n    return task(Tasks.RootTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n      .notify(this.NotifyCommand)\n  }\n}\n```\n\n#### notify\n\nSet a notify handler command. This command executed by call of `this.notify`\ninside a task with the same arguments as passed to `this.notify`\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### success\n\nSet a success handler command. Will be executed with a value returned\nfrom the task, or if the task returned a Promise – with resovled value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### fail\n\nSet a fail handler command. Will be executed with error throwed in the task,\nor if the task returned a Promise – with rejected value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### multithread\n\nDefine the task to be \"multi-thread\", so every call\nwill run in parallel with other calls of the same task\nin scope of one process (model).\n\n**Parameters**\n\n-   `val` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### engine\n\nSet task executor function. The executor function should return an object\nthat should have at least two fields: `exec` and `cancel` functions.\n`exec` should return a promise which should be resolved or rejected\nwith an object `{ result, error }`. A `cancel` function should stop\nthe task execution.\n\n**Parameters**\n\n-   `engine` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that returns\n                               `{ exec: Function, cancel: Function }` object\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### args\n\nOverride arguments which will be passed to the task\nstarting from second argument. By default a task will receive\nthe same set of arguments as a task command. If this function invoked,\nthen the task will receive given arguments instead of command arguments.\n\n**Parameters**\n\n-   `args` **...any**\n\nReturns **[TaskMeta](#taskmeta)**\n\n### DefaultLogger\n\nA class which defins a logger for tracking command execution process.\nThe default implmenetation just defines all possible logger\nmethods (log points) and print errors to the console.\nExtend this class to define your own logging functionality\n(like logging errors with Setnry or Loggly)\n\n**Examples**\n\n```javascript\n// ./index.js\nimport { DefaultLogger, run } from 'mangojuice-core';\nimport MainBlock from './blocks/MainBlock';\n\n// Implement custom logger\nclass SetnryLogger extends DefaultLogger {\n  onCatchError(error, cmd) {\n    Raven.catchException(error);\n  }\n}\n\n// Pass instance of the Logger to `run` options object.\nrun(MainBlock, { logger: new SetnryLogger() });\n```\n\n#### onStartExec\n\nThis method invoked right before anything else - as the first thing\nin [Process#exec](#processexec). Even before any [LogicBase#hubBefore](#logicbasehubbefore).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that just started execution process\n\n#### onStartHandling\n\nInvoked right before command will go through all [LogicBase#hubBefore](#logicbasehubbefore) or [LogicBase#hubAfter](#logicbasehubafter)\nup in the blocks tree. The second argument indicates is it called for [LogicBase#hubBefore](#logicbasehubbefore)\nor for [LogicBase#hubAfter](#logicbasehubafter).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that is going to go through hubs in parent blocks\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command is going through \"after\" hubs, \"before\" otherwise\n\n#### onEndHandling\n\nInvoked when the command went through all hubs and when all sync commands\nreturned from hubs was executed.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that went through all hubs\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command going through \"after\" hubs, \"before\" otherwise\n\n#### onExecuted\n\nInvoked when the command function executed and the return of the function processed –\nall returned commands executed, all async tasks started, the model updated.\nBut it invoked before the command go through \"after\" hubs.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was exectued and the return processed\n-   `result` **any** Returned object from the command's function\n\n#### onEndExec\n\nInvoked right after the command go throught \"after\" hubs. It is the final\nstage of command execution.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was fully executed and handled by parent blocks\n\n#### onCatchError\n\nInvoked if any uncaught error happened while execution of the command\nor anywhere else in the logic, like in [LogicBase#port](#logicbaseport) or in [LogicBase#computed](#logicbasecomputed).\nBy default print the error using `console.error`.\n\n**Parameters**\n\n-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** The error instance\n-   `cmd` **[Command](#command)?** Command that was executing while the error happened\n\n### ComputedField\n\nClass for declaring computed field with model dependencies.\nGiven array shuold contain models, binded to some\nlogec. They will be passed to compute function in the same order.\nAlso they will be used to track changed and re-compute.\n\nThe class is immutable, so any call to any method will create\na new instance of `ComputedField` and the old one won't be touched.\n\n**Parameters**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**\n\n**Properties**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** An array of models with binded logic\n                                    (attached some [Process](#process))\n-   `computeFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that will be used\n                                    to compute value of the computed field.\n\n#### compute\n\nCreates a new instance of the field and set compute function in it.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that should return a value that\n                             will be used as a value for some computed field in\n                             a model. This function will be invoked with all\n                             dependency models as arguments\n\n**Examples**\n\n```javascript\n// A way to override computed field of some base logic class\n// (thanks to immutability of `ComputedField`)\nclass MyLogic extends SomeOtherLogic {\n  computed() {\n    const oldComputed = super.computed();\n    return {\n      ...oldComputed,\n\n      // Override `oldField` compute function with saved dependencies\n      // and use overrided compute function inside new compute function\n      oldField: oldComputed.compute((...deps) => {\n        return 1 > 0 || oldComputed.oldField.computeFn(...deps);\n      })\n    };\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** New instance of the ComputedField with `computeFn`\n                         set to given function.\n\n### Mounter\n\nTo use [mount](#mount) function you need to implement a Mounter interface\nwhich should have `mount` and `unmount` functions. It is up to the developer\nhow these functions will be implemented and what view library they will use.\n\nThere is a rule that mounter and view library should follow: view of\na model should be updated only when the model updated and the update\nshouldn't touch views of children models (children views shouldn't be updated\nbecause their models is not changed).\n\nReact perfectly fits for this rule. By implementing `shuoldComponentUpdate`\nyou can control when the component should be updated and when shouldn't. In this\ncase this function should always return `false` and componenent should be\nupdated using `forceUpdate` only when the model is updated (using [observe](#observe)).\n\n**Properties**\n\n-   `mount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that should expect two arguments: model object with\n                                  attached [Process](#process) instance and [Block#View](Block#View).\n                                  It should render the model using given View (somehow).\n-   `unmount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuold unmount mounted view from DOM.\n\n**Examples**\n\n```javascript\n// Minimal react mounter which follow the rules\nclass ViewWrapper extends React.Component {\n  componentDidMount() {\n    const { model } = this.props;\n    this.stopObserver = observe(model, () => this.forceUpdate())\n  }\n  componentWillUnmount() {\n    this.stopObserver();\n  }\n  shouldComponentUpdate() {\n    return false;\n  }\n  render() {\n    const { View, model } = this.props;\n    const Logic = logicOf(model);\n    return <View model={model} Logic={Logic} />\n  }\n}\nclass ReactMounter {\n  mount(model, View) {\n    return React.render(\n      <ViewWrapper View={View} model={model} />,\n      document.querySelector('#container')\n    );\n  }\n  unmount() {\n    return React.unmountComponentAtNode(\n      document.querySelector('#container')\n    );\n  }\n}\n```\n\n### defineCommand\n\nProvides a way to define a command in the prototype without\nusign a decorator. You should give a prototype of the logic class,\nname of the function which should be converted to a command factory\nand the decorator function (optional).\n\nIf the decorator function is not provided, then [cmd](#cmd) will be used\nby default.\n\n**Parameters**\n\n-   `proto` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Logic class prototype\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Method name that you want to convert to a command factory\n-   `decorator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** Optional decorator function\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n  // throttle 100\n  ThrottledCommand() {\n    return this.SomeCommand();\n  }\n}\n\ndefineCommand(MyLogic.prototype, 'SomeCommand');\ndefineCommand(MyLogic.prototype, 'ThrottledCommand', cmd({ throttle: 100 }));\n```\n\n### ensureCommand\n\nReturns a [Command](#command) instance or throw an error if given\nargument can't be used to create a [Command](#command) (is not a Command\nor command factory).\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** [Command](#command) instance or command factory. When\n                                     command factory then it will be invoked with\n                                     no arguments to create a command\n\n**Examples**\n\n```javascript\nclass MyLogic() {\n  \\@cmd SomeCommand() {\n    // do something\n  }\n}\n\nconst logic = new MyLogic();\nensureCommand(logic.SomeCommand) // returns Command instance\n// equals to...\nlogic.SomeCommand()\n```\n\nReturns **[Command](#command)**\n\n### decorateLogic\n\nBy given logic class go through prototypes chain and\ndecorate all cmd functions. Use it if you can't use decorators\nin your project\n\nIt determine that the function should be converted to a command\nfactory (decorated by [cmd](#cmd)) by its name. If the function\nstarts with uppercase letter or underscore+upper-letter, then it\nis considered as a command.\n\n**Parameters**\n\n-   `LogicClass` **[LogicBase](#logicbase)** Logic class that you want to decorate\n-   `deep` **bool** If true then it will go though prototypes chain and\n                        decorate every prototype in the chain.\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n  }\n  _SomePrivateCommand() {\n  }\n  notACommand() {\n    return 123;\n  }\n}\n\n// `SomeCommand` and `_SomePrivateCommand` will be decorated with `cmd`\n// (the prorotype will be changed in-place). `notACommand` won't\n// be decorated.\ndecorateLogic(MyLogic);\n\nconst logic = new MyLogic();\nlogic.SomeCommand() // returns Command instance\nlogic._SomePrivateCommand() // returns Command instance\nlogic.notACommand() // returns 123\n```\n\n### handleBefore\n\nFunction adds a handler to the [Process](#process) attached to a given\nmodel that will be invoked before every command running for this\nmodel. The handler won't be invoked for commands from children\nmodels of given model.\n\nReturns a function that removes the handler from the Process\n(stop handling)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called before every own command\n\n**Examples**\n\n```javascript\nimport { handleBefore, run, logicOf } from 'mangojuice-core';\n\n// Define root and child logic\nclass ChildLogic {\n  \\@cmd ChildCommand() {}\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  \\@cmd RootCommand() {}\n}\n\n// Run block with empty models\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ childModel: {} })\n});\n\n// Adds a handler to a root model\nhandleBefore(res.model, (cmd) => console.log(cmd));\n\n// Run commands on root and child models\nres.proc.exec(logicOf(res.model).RootCommand);\nres.proc.exec(logicOf(res.model.childModel).ChildCommand);\n\n// In the console will be printed only `RootCommand` command object\n// right before the command will be executed\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### handleAfter\n\nIt is the same as [handleBefore](#handlebefore) but the handler will be invoked\n**after** every own command.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### handle\n\nAlias for [handleAfter](#handleafter)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### logicOf\n\nReturns a Logic instance attached to a given model object. The logic\ninstance stored in attached [Process](#process) instance, so it execute\n[procOf](#procof) for the model to get a [Process](#process) instance and then\nget the logic instance form a Process and return it.\n\nIf Process is not attached to the model, then an Error will be throwed.\nIf the second argument passed then it will also check that the logic\ninstance is instance of some particular class.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `logicClass` **Class?** Optional logic class to check that the logic\n                                  instance is instance of the class\n\nReturns **[LogicBase](#logicbase)** Returns a logic instance\n\n### observe\n\nA function that adds a handler to the [Process](#process) instance attached\nto a given model, that will be invoked on every command that changed\nthe model. Useful for tracking changes to re-render a view of the model.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process) instance\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be invoked after every command\n                                that changed the model.\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object with options\n    -   `options.batched` **bool** If true then the handler will be invoked only when\n                                        the commands stack is empty and model was changed during\n                                        the stack execution. Useful to reduce amount of not necessary\n                                        view re-renderings.\n\n**Examples**\n\n```javascript\nimport { run, cmd, observe, logicOf } from 'mangojuice-core';\n\nclass MyLogic {\n  \\@cmd MultipleUpdates() {\n    return [\n      this.UpdateOne,\n      this.UpdateTwo\n    ];\n  }\n  \\@cmd UpdateOne() {\n    return { one: this.model.one + 1 };\n  }\n  \\@cmd UpdateTwo() {\n    return { two: this.model.two + 1 };\n  }\n}\n\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ one: 1, two: 1 })\n});\n\nobserve(res.model, () => console.log('not-batched'));\nobserve(res.model, () => console.log('batched'), { batched: true });\n\nres.proc.exec(logicOf(res.model).MultipleUpdates);\n\n// `not-batched` will be printed two times\n// `batched` will be printed only once\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n\n### procOf\n\nGet a [Process](#process) instance attached to the given model object.\nInternally it get a `__proc` field from the given model and returns it.\n\nIf given model do not have attached Process, then an Error will be throwed,\nbut only if the second argument is not true, which ignores the error.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `ignoreError` **bool** If true then no error will be throwed if Process\n                               is not attached to the model\n\nReturns **[Process](#process)** An instance of [Process](#process) attached to the model\n\n### bind\n\nThis function do the following:\n\n-   Creates a model object using [Block#createModel](Block#createModel). It is invoked without\n    arguments.\n-   Create a [Process](#process) instance with logic from [Block#Logic](Block#Logic)\n-   Call [Process#bind](#processbind) with created model\n\nReturns an object with created process instance, model object and given block.\nUsefull when you want to prepare the block to run but you want to run it manually.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A [Block](#block) object\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options object that could change [Process](#process) behaviour (optional, default `{}`)\n    -   `opts.logger` **[DefaultLogger](#defaultlogger)?** A custom logger instance that will be used in the\n                                               Process to track commands execution. By default\n                                               [DefaultLogger](#defaultlogger) will be used.\n    -   `opts.shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object that will be available in any logic in the\n                                          tree as `this.shared`. Could be anything you want, but\n                                          you will get more benifites if you will pass model object\n                                          with attached Process as shared object to be able to make\n                                          computed fields with depending of shared model.\n    -   `opts.args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>?** An array of arguments that will be passed to [LogicBase#config](#logicbaseconfig)\n                                               of the logic.\n    -   `opts.Process` **[Process](#process)?** A class that will be used instead of [Process](#process). By default\n                                          general [Process](#process) is used, but you can customize it for your\n                                          specific needs and pass here. Then every other process in the tree\n                                          will be an instance of this custom [Process](#process) implementation\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block)}** An object with [Process](#process) instance, model object and block that was passed to\n   the function\n\n### hydrate\n\nThis function replace a `createModel` function in given block\nwith new function that just returns a given model. It is useful\nwhen you have some old model and just want to run everytihing with\nit (for example for server rendering, or hot module replacement)\n\n**Parameters**\n\n-   `block` **[Block](#block)** An original block\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to use\n\n**Examples**\n\n```javascript\n// Hot module replacement example\nimport MyBlock from './MyBlock';\nimport { hydrate, run } from 'mangojuice-core';\n\n// Run initial block\nlet res = run(MyBlock);\n\n// When block changed destroy the old process, hydrate a new\n// block with existing model and run hydrated new block again\nmodule.hot.accept(['./MyBlock'], () => {\n  res.proc.destroy();\n  const newBlock = hydrate(require('./MyBlock'), res.model);\n  res = run(newBlock);\n});\n```\n\nReturns **[Block](#block)** A new block with replaced `createModel` function\n                 which just returns a model that you passed as\n                 second argument.\n\n### delay\n\nA helper function for delaying execution. Returns a Promise\nwhich will be resolved in given amount of milliseconds. You can\nuse it in [task](#task) to implement some delay in execution, for\ndebouncing for example.\n\n**Parameters**\n\n-   `ms` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** An amount of milliseconds to wait\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that resolved after given amount of milliseconds\n","readmeFilename":"README.md","_id":"mangojuice-core@2.0.0-3","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-PTBzT5cnMrqyf0gINT1XgCOqMNyEK6UYE+AH/7fRexXElxqQxbFTpQcBelWj6QcgCAQ8pdY/TrtBUJF2J5W1/A==","shasum":"1673cd27cc33e4b4c297a3d802406da85a37f1ec","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-2.0.0-3.tgz","fileCount":34,"unpackedSize":1877956,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDzo3METqh/GxPehLJq9IOrb0b5D2S/MHvzTNcg3vNvogIgFn8sDZgrDoQ+kC/51jas/2ZxRk80Zq2FERUYXzzOVSE="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core_2.0.0-3_1519631575103_0.2592872978001255"},"_hasShrinkwrap":false},"2.0.0-4":{"name":"mangojuice-core","version":"2.0.0-4","description":"## Reference","author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"license":"MIT","main":"index.js","rollup":{"moduleName":"Mjs"},"readme":"# MangoJuice Core\n\n## Reference\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n#### Table of Contents\n\n-   [Basic](#basic)\n    -   [Block](#block)\n    -   [LogicBase](#logicbase)\n        -   [config](#config)\n        -   [children](#children)\n        -   [computed](#computed)\n        -   [port](#port)\n        -   [hubAfter](#hubafter)\n        -   [hubBefore](#hubbefore)\n    -   [cmd](#cmd)\n    -   [run](#run)\n    -   [mount](#mount)\n    -   [task](#task)\n    -   [cancel](#cancel)\n    -   [child](#child)\n    -   [depends](#depends)\n-   [Extras](#extras)\n    -   [Process](#process)\n        -   [bind](#bind)\n        -   [run](#run-1)\n        -   [destroy](#destroy)\n        -   [exec](#exec)\n        -   [finished](#finished)\n    -   [Command](#command)\n        -   [exec](#exec-1)\n        -   [clone](#clone)\n        -   [is](#is)\n        -   [appendArgs](#appendargs)\n        -   [bind](#bind-1)\n    -   [TaskMeta](#taskmeta)\n        -   [notify](#notify)\n        -   [success](#success)\n        -   [fail](#fail)\n        -   [multithread](#multithread)\n        -   [engine](#engine)\n        -   [args](#args)\n    -   [DefaultLogger](#defaultlogger)\n        -   [onStartExec](#onstartexec)\n        -   [onStartHandling](#onstarthandling)\n        -   [onEndHandling](#onendhandling)\n        -   [onExecuted](#onexecuted)\n        -   [onEndExec](#onendexec)\n        -   [onCatchError](#oncatcherror)\n    -   [ComputedField](#computedfield)\n        -   [compute](#compute)\n    -   [Mounter](#mounter)\n    -   [defineCommand](#definecommand)\n    -   [ensureCommand](#ensurecommand)\n    -   [decorateLogic](#decoratelogic)\n    -   [handleBefore](#handlebefore)\n    -   [handleAfter](#handleafter)\n    -   [handle](#handle)\n    -   [logicOf](#logicof)\n    -   [observe](#observe)\n    -   [procOf](#procof)\n    -   [bind](#bind-2)\n    -   [hydrate](#hydrate)\n    -   [delay](#delay)\n\n### Basic\n\nThe most common APIs that you will work with most of the time\n\n\n#### Block\n\nBlock is a top level component in MangoJuice which consists of three parts:\n\n-   Model factory function `createModel` which should return a plain object.\n    The main requirement for this function is that it should be able to return\n    some model with zero arguments. But it can also accept some arguments\n    as well.\n-   A logic class which implements [LogicBase](#logicbase) interface\n-   A View function which is aimed to render the model created by `createModel`\n\nThe View part is optional and it could have different type depending on\nselected View library to render a model and particular binding library.\n\n**Properties**\n\n-   `Logic` **[LogicBase](#logicbase)** A logic class that should be attached to the model.\n-   `createModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuld return a plain object which\n                                      will be an init model of the block.\n-   `View` **any?** Something that some particular view library can render\n\n**Examples**\n\n```javascript\n// You can define block in short way using an object\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nrun(MyBlock);\n```\n\n```javascript\n// Or you can split it with modules (recommended)\n// ./MyBlock/index.js\nimport Logic from './Logic';\nimport View from './View';\nimport { createModel } from './Model';\nexport default { View, Logic, createModel };\nexport { View, Logic, createModel };\nexport type { Model } from './Model';\n\n// ./MyBlock/Logic.js\nimport type { Model } from './Model';\nimport { LogicBase, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  \\@cmd SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n}\n\n// ./MyBlock/Model.js\nexport type Model = { field: number };\nexport const createModel = () => ({\n  field: 1\n});\n\n// ./MyBlock/View.js\nconst MyBlockView = ({ model }) => (\n  <div>{model.field}</div>\n);\nexport default MyBlockView;\n\n// ./index.js\nimport MyBlock from './MyBlock';\nimport { run } from 'mangojuice-core';\n\nrun(MyBlock);\n```\n\n#### LogicBase\n\nBasic class for every logic. It is not necessaty to inherit an actual logic\nclass from it, but for better type-checking it could be really usefull.\n\nLogic class defines:\n\n-   A set of commands that could change an associated model – methods decorated with [cmd](#cmd)\n-   What fields of the model should be associated with which logic class\n    (children blocks) – [LogicBase#children](#logicbasechildren) method\n-   A set of computed model fields – [LogicBase#computed](#logicbasecomputed) method\n-   A set of rules to handle commands from children logic – [LogicBase#hubAfter](#logicbasehubafter)\n    and [LogicBase#hubBefore](#logicbasehubbefore) methods\n-   A logic to handle external events – [LogicBase#port](#logicbaseport) method.\n\nThe logic class defines all the business-logic of some part of your application.\nThe main goal of the logic – change associated model. Check [cmd](#cmd) and [Process#exec](#processexec)\nto have a better understanding how command can be defined and how it is executed.\n\n**Properties**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object which is associated with the\n                               logic class in parent logic.\n-   `meta` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object defined in [LogicBase#config](#logicbaseconfig) method for storing\n                               some internal logic state.\n-   `shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object with some shared state, defined while\n                               run process of the app.\n\n**Examples**\n\n```javascript\n// ./blocks/MyBlock/Logic.js\n// @flow\nimport type { Model } from './Model';\nimport ChildBlock from '../ChildBlock';\nimport { Command, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  children() {\n    return { child: ChildBlock.Logic };\n  }\n  hubAfter(cmd: Command) {\n    if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n      return this.TestCommand(123);\n    }\n  }\n  \\@cmd TestCommand(arg) {\n    return { field: arg + this.model.field };\n  }\n}\n```\n\n##### config\n\nA function that defines init commands and meta object of the\nlogic. Can accept any type and number of arguments. Config\nwill take arguments passed to [child](#child) function (for example\n`child(MyLogic, 1, 2, 3)` defines that the `config` method of\n`MyLogic` will be invoked like `config(1, 2, 3)`)\n\nCould return an object with the fields:\n\n-   `initCommands` which could be an array or a single Command,\n    that will be executed every time when the logic instance created\n    and associated with some model (when [Process#run](#processrun) invoked)\n-   `meta` which could be an object with some internal state of\n    the logic\n\n**Examples**\n\n```javascript\nconfig(props) {\n  return {\n    initCommands: [ this.StartThis, this.SendThat(123) ],\n    meta: { something: props.amount }\n  };\n}\n```\n\n##### children\n\nThis function defines what logic class should be associated\nwith which model field. Should return an object where a key is\na model field name, and a value is a logic class or an object\nthat defines logic with arguments (return from [child](#child) function)\n\n**Examples**\n\n```javascript\nchildren() {\n  return {\n    searchForm: child(SearchForm.Logic, { timeout: 100 }),\n    searchResults: SearchResults.Logic\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n##### computed\n\nShould return an object which defines computed fields of the model.\nA key of the object is a model field, and value is a function or\ncomputed function definition object (return from [depends](#depends) function).\n\nComputed field is lazy, which means that it is computed on the first use\nof the field and the computation result cached until the next update\nof the model.\n\nIf you want to define a computed field which ueses in computation not\nonly fields from the own model, but maybe some values from child model,\nor from shared model, then you will need to use [depends](#depends) function to\ndefine what models used while computation to observe changes of these\nmodels to trigger an update event of the own model (to update views).\n\n**Examples**\n\n```javascript\ncomputed() {\n  return {\n    simple: () => this.model.a + this.model.b,\n    withDeps: depends(this.model.child, this.shared).compute(() => {\n      return this.model.child.a + this.shared.b + this.model.c;\n    })\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n##### port\n\nA function to handle global event, such as browser-level events,\nwebsocket, intervals. The main porpouse of the `port` is to subscribe\nto some global events, execute appropriate commands from the logic\non the events and remove the handlers when the logic was destroyed.\n\n**Parameters**\n\n-   `exec` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** It is a function that execute a passed command\n-   `destroyed` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that will be resolved when the logic destroyed\n\n**Examples**\n\n```javascript\nport(exec, destroyed) {\n  const timer = setInterval(() => {\n    exec(this.SecondPassed);\n  }, 1000);\n  destroyed.then(() => clearInterval(timer));\n}\n```\n\n##### hubAfter\n\nHub for all commands executed in the children blocks. The only\narguments is a command object that was executed.\nCould return a Command or an array of Commands that should\nbe executed next.\nMost of the time this function will look like a `switch`,\nbut maybe with some additional rules for the cases. Take a look\nto [Command#is](#commandis) function to have a better understanding how you\ncan determine that the command is exactly what you are waiting for.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was executed in some child logic\n                           or in any child of the child and so on down to\n                           the leaf of the tree.\n\n**Examples**\n\n```javascript\nhubAfter(cmd) {\n  if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n    return this.HandlerCommand(123);\n  }\n  if (cmd.is('AnotherChild.SomeAnothercommand')) {\n    return [ this.HandlerCommand(321), this.AnotherHandler ];\n  }\n}\n```\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)** \n\n##### hubBefore\n\nSame as [LogicBase#hubAfter](#logicbasehubafter), but catch commands before\nit will be actually executed, so you can compare prev and next\nmodel state for example.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)** \n\n#### cmd\n\nDecorator that converts a logic method to a command factory.\nThe result function (command factory function) is a function\nthat return a [Command](#command) instnace with the decorated function\nand arguments that you will pass to a command factory function.\n\nYou can use this decorator without arguments or with an options\nargument (object)\n\nCheck [Process#exec](#processexec) to see what the origin function\ncould return to do something. If in short, it can return:\nnothing, command (or factory or array of commands), task,\nmodel update object.\n\n**Parameters**\n\n-   `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** If only this argument passed then it will be considered\n                                   as options object which can customize command behaviour.\n    -   `obj.debounce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be debounced by given amount of\n                                       milliseconds\n    -   `obj.throttle` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be throttled by given amount of\n                                       milliseconds\n    -   `obj.noInitCall` **bool** If true then debounced/throttled execution\n                                       won't start with init command call. By default\n                                       debounced/throttled command will be instantly\n                                       exected and only then wait for a chance to execute\n                                       again. With `noInitCall=true` there is no instant init\n                                       command call.\n    -   `obj.internal` **bool** Make the command invisible for parent [LogicBase#hubBefore](#logicbasehubbefore)\n                                       and [LogicBase#hubAfter](#logicbasehubafter). Use it for commands that shouldn't\n                                       be handled by hubs to increse performance.\n    -   `obj.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** By default name of the command taken from origin function. With this\n                                       option you can override the name with any other value.\n-   `methodName`  \n-   `descr`  \n\n**Examples**\n\n```javascript\nclass RegularLogic {\n  \\@cmd RegularCommand() {\n    // do something\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ debounce: 300 })\n  DebouncedCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 600ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300 })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300, noInitCall: true })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 1 time in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ internal: true })\n  _InternalCommand() {\n    // this command can't be caught in `hubBefore` or `hubAfter`\n    // in parent logics. Use it carefully.\n  }\n}\n```\n\nReturns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory function (if all three arguemnts passed)\n                               or a decorator function with binded options object\n                               (that you pass as a first argument)\n\n#### run\n\nRun given block. It is a short-hand function for running [bind](#bind)\nand then running a Process by [Process#run](#processrun).\nAlso it returns an additional `finished` Promise which is resolved\nwhen all async tasks finished and all handler commands executed.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A block that you wan to run\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Same options as in [bind](#bind) (optional, default `{}`)\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block), finished: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)}** An object\n                 which is almost the same as returned from [bind](#bind), but with\n                 additional `finished` field, which is a Promise that will be resolved\n                 when all blocks will execute all commands and all async tasks will be\n                 finished.\n\n#### mount\n\nMount running block. As third and next arguments you can pass other running\nblocks which will be stopped with the main running block (useful for HMR).\n\n**Parameters**\n\n-   `mounter` **[Mounter](#mounter)** An implementation of [Mounter](#mounter) interface\n-   `runRes` **{proc: [Process](#process), block: [Block](#block), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}** An object that returned\n                     from [run](#run) function.\n-   `otherBlocks` **...any** \n\n**Examples**\n\n```javascript\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nmount(new ReactMounter(), run(MyBlock));\n```\n\nReturns **{view: any, stop: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)}** An object with the result form [Mounter#mount](Mounter#mount)\n                 function (in `view` field) and stop function which destroy the process and\n                 unmount a view using [Mounter#unmount](Mounter#unmount)\n\n#### task\n\nCreates a [TaskMeta](#taskmeta) object that could be returned from\nasync task command. It describes the task that should be executed.\n\nFor more information what the **Task** is and how it should be implemented\ntake a look to [TaskMeta](#taskmeta).\n\n**Parameters**\n\n-   `taskFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that could return a Promise\n\n**Properties**\n\n-   `CANCEL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A symbol that you can use to make a promise \"cancellable\"\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n#### cancel\n\nThis function should be used to cancel async [task](#task) execution.\nAlso it can cancel the debounced/throttled command.\n\n-   In case with task, if task was executing while you call a cancel command,\n    the task will be cancelled (execution stopped). Otherwise nothing will happen.\n-   In case with debounced/throttled command, if the command scheduled to be executed\n    then the schedule timer will be cleared and the command won't be executed.\n    If the command is not scheduled then nothing happens.\n\nTo use it just pass a command or command factory as a first argument\nand return it from some other command.\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Command or command factory that you wan to cancel. Could\n                                    be a command that returns [task](#task) or debounced/throttled\n                                    command\n\n**Examples**\n\n```javascript\nclass SomeLogic {\n  \\@cmd CancelSomethingCommand() {\n    return [\n      cancel(this.TaskCommand),\n      cancel(this.DebounceCommand)\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask);\n  }\n  \\@cmd({ debounce: 300 })\n  DebounceCommand() {\n    // do something\n  }\n}\n```\n\nReturns **[Command](#command)** Returns a new command that will cancel the execution of the command\n                  passed as an argument.\n\n#### child\n\nCreates an object which describes child logic which will be attached\nto some model field. Should be used in [LogicBase#children](#logicbasechildren) to\ndefine a logic that should be instantiated with some arguments passed\nto [LogicBase#config](#logicbaseconfig).\n\n**Parameters**\n\n-   `logicClass` **[LogicBase](#logicbase)** Class that imlements [LogicBase](#logicbase) interface\n-   `args` **...any** \n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  config(amount) {\n    return { meta: { amount } };\n  }\n}\nclass RootLogic {\n  children() {\n    return {\n      modelField: child(ChildLogic, 10)\n      // `config` of `ChildLogic` will be invoked with\n      // `10` as a first argument\n    }\n  }\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object that contains a logic class and an arguments array that\n                 should be used to invoke `config` method of provided logic class.\n\n#### depends\n\nFunction that helps to describe a computed field with external\nmodel dependncies. Should be used in [LogicBase#computed](#logicbasecomputed).\nIt creates an instance of [ComputedField](#computedfield) with dependencies\npassed as arguments.\n\nA compute field with external dependencies is a field that should\nbe updated (re-computed) not only when the own model udpated, but\nalso when depdendency models updated.\n\n**Parameters**\n\n-   `deps` **...deps** A list of models with attached logic\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  // some logic\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  computed() {\n    return {\n      // depends on `childModel`\n      computedField: depends(this.model.childModel).compute(() => {\n        return this.model.a + this.model.childModel.b;\n      }),\n\n      // depends on `shared` model\n      computeWithShared: depends(this.shared).compute(() => {\n        return this.model.b + this.shared.someField;\n      })\n    }\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** \n\n### Extras\n\nOther pieces of MangoJuice\n\n\n#### Process\n\nThe main class of MangoJuice that ties model, logic and view together.\n\nIt works in the following way:\n\n-   You create a model for your app (object) using `createModel` of\n    the root block. The result is a plain object.\n-   Then you need to create an instance of Process and pass logic class\n    in the options object.\n-   Then you `bind` the Process instance to the model object you created on step one.\n    \"To bind Process to a model\" means that in the model will be created a hidden\n    field `__proc` with a reference to the Process instance.\n-   After that you can `run` the Process, which will execute init commands, port.\n\n`bind` and `run` also look at the object returned from [LogicBase#children](#logicbasechildren)\nand create/run Process instances for children models.\n\nMost of the time you do not need to care about all of these and just use\n[run](#run) and [mount](#mount). These small functions do everything described\nabove for you.\n\n**Examples**\n\n```javascript\nimport { Process, logicOf } from 'mangojuice-core';\n\nconst ExampleBlock = {\n  createModel() {\n    return { a: 10 };\n  },\n  Logic: class Example {\n    \\@cmd Increment(amount = 1) {\n      return { a: this.model.a + amount };\n    }\n  }\n};\n\nconst model = ExampleBlock.createModel();\nconst proc = new Process({ logic: ExampleBlock.Logic });\nproc.bind(model);\nproc.run();\nproc.exec(logicOf(model).Increment(23));\n```\n\n##### bind\n\nBind the process instance to a given model, which means that hidden\n`__proc` field will be created in the model with a reference to the\nProcess instance.\n\nAlso bind all children models – go through children definition returned\nby [LogicBase#children](#logicbasechildren), create Process for each child and bind\nit to an appropreat child model object.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to bind to the Process.\n\n##### run\n\nRun the process – run children processes, then run port and\ninit commands defined in config.\nAlso run all model observers created by [observe](#observe)\n\n##### destroy\n\nDestroy the process with unbinding from the model and cleaning\nup all the parts of the process (stop ports, computed fields).\n`__proc` field will be removed from the model object and all\nchildren objects.\n\n**Parameters**\n\n-   `deep` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then all children blocks will be destroyed.\n                             By default, if not provided then considered as true.\n\n##### exec\n\nExec a command in scope of the Process instance.\nIt will use binded model and logic object to run the\ncommand. The command could be function (command factory)\nor object ([Command](#command) instance).\n\nA command origin function could return three types of things:\n\n-   Another [Command](#command)/command factory or an array of commands\n    (an element of the array also could be another array with commands\n    or null/undefined/false). All commands will be execute in provided order.\n-   An instance of [TaskMeta](#taskmeta) (which is usually created by [task](#task)\n    helper function). The returned task will be started and do not block\n    execution of next commands in the stack.\n-   A plain object which is a model update object. The object will be merged\n    with current model.\n\nIf command is undefined or `Process` instance not binded\nto any model it will do nothing.\n\n**Parameters**\n\n-   `cmd` **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory or Command instance\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  \\@cmd BatchCommand() {\n    return [\n      1 > 2 && this.SomeCoomand,\n      this.AnotheCommand(123),\n      2 > 1 && [\n        this.AndSomeOtherCommand,\n        this.FinalCommand()\n      ]\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n  }\n  \\@cmd ModelUpdateCommand() {\n    if (Math.random() > 0.6) {\n      return { field: Date.now() };\n    }\n  }\n}\n```\n\n##### finished\n\nReturns a promise which will be resolved when all async\ntasks and related handlers in the process and all children\nprocesses will be finished.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n#### Command\n\nClass which declares a command that will be executed in the\nfuture by some [Process#exec](#processexec). It contains a function that will be\nexecuted, arguments that should be passed to the function\nand command name.\n\nThe command also keep a context that should be used to execute\na function. Usually this context is some logic instance. You\ncan bind a context to the command using [Command#bind](#commandbind) function.\n\nThe command instance is immutable, so any function that\nmakes some change in the command will produce a new command\ninstead of changing the original one.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** \n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n**Properties**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** An origin function that should be executed\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** A set of arguments that should be used\n                                 to execute the fucntion.\n\n##### exec\n\nExecute a function stored in the command instance. It passes\nstored arguments to the function and call it in stored context.\nReturns the value that was returned form the function.\n\nReturns **any** \n\n##### clone\n\nClone instance of the command\n\nReturns **[Command](#command)** \n\n##### is\n\nCheck is the command equal to some other command or have\na reference to the same origin function. Optionally you can also\ncheck that the command binded to some concrete model (using\nthe second argument).\n\nYou can use many different formats to define the command to check:\n\n-   Just a string, which should be constructed like\n    `Logic Class Name + Function Name`\n-   Command object or command factory that you can get from prorotype\n    of some logic class.\n-   Binded command object or command factory that you can get from\n    concrete model using [logicOf](#logicof) function\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Command object or command factory or command name\n-   `childModel` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Model object that should be binded to the command (optional)\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  \\@cmd SomeCommand() {}\n}\nclass MyLogic {\n  hubAfter(cmd) {\n    if (cmd.is('ChildLogic.SomeCommand')) {\n      // by command name\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand)) {\n      // by command factory\n    }\n    if (cmd.is(logicOf(this.model.child).SomeCommand)) {\n      // by binded to a concrete model command factory (commands\n      // binded for other models will be ignored)\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand, this.model.child)) {\n      // by command factory and concrete child model (commands\n      // binded for other models will be ignored)\n    }\n  }\n}\n```\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the command have same name, or same origin function\n                                and binded to same model (if second argument provided)\n\n##### appendArgs\n\nCreates a new Command instance (clone the command) and append\ngiven list of arguments to the current list of arguments.\nReturns a new Command with new list of arguments.\n\n**Parameters**\n\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of arguments that will be appened\n                               to tne new Command\n\nReturns **[Command](#command)** New command with appended arguments\n\n##### bind\n\nCreates a new Command instance and set given logic instance in it.\nAlso update command name by name of the origin function and name\nof the logic class.\n\n**Parameters**\n\n-   `logic` **[LogicBase](#logicbase)** A logic instance that should be binded to a command\n\nReturns **[Command](#command)** New command binded to given logic instance\n\n#### TaskMeta\n\nClass for declaring an async task. An instance of this object returned\nfrom [taks](taks) function.\n\nA task function is a function that could return a Promise. The resolved value\nwill be passed to a success command handler, the rejected command will be passed\nto a fail command handler.\n\nIf task function do not return a Promise, then the returned value passed to a\nsuccess command, and if the function throw an error then the error passed to\na fail command.\n\nThe task function receive at least one argument – an object with `model`, `shared`\nand `meta`. All the next arguments will be given from a command that returned a task,\nif it is not overrided by [TaskMeta#args](#taskmetaargs)\n\nBy default a task is single-threaded. It means that every call to a task will cancel\npreviously running task if it is running. You can make the task to be multi-threaded\nby [TaskMeta#multithread](#taskmetamultithread), so every call to a task won't cancel the running one.\n\nIn a context of the task function defined special `call` function. This function should\nbe used to invoke sub-tasks. It is important to use `call` to run sub-tasks because\n`call` create a cancellation point of the task – if the task cancelled, then nothing\nwill be executed after currently running `call` sub-task.\n\n`call` returns an object with `result` and `error` fields. If `error` field is not\nempty, then something weird happened in the sub-task. `call` internally have a try/catch,\nso it is not necessary to wrap it with try/catch, just check the `error` field in the\nreturned object and if it is not empty – handle it somehow (throw it, or do any custom\nerror handling)\n\nAlso in a context of the task defined a `notify` function. It is a function that execute\nnotify command if it is defined. The command executed with the same arguments as passed\nto `notify` function. You can use it to incrementally update a model while the long\ntask is executing, to show some progress for the user.\n\n**Parameters**\n\n-   `taskFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n-   `executor` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n**Examples**\n\n```javascript\nasync function SubTask(a, b, c) {\n  this.notify(a + b + c);\n  await this.call(delay, 100);\n  return (a / b * c);\n}\nasync function RootTask({ model }) {\n  const { result, error } = await this.call(SubTask, 1, 0, 3);\n  if (error) {\n    throw new Error('Something weird happened in subtask')\n  }\n  return result + 10;\n}\n```\n\n```javascript\nclass MyLogic {\n  \\@cmd AsyncCommand() {\n    return task(Tasks.RootTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n      .notify(this.NotifyCommand)\n  }\n}\n```\n\n##### notify\n\nSet a notify handler command. This command executed by call of `this.notify`\ninside a task with the same arguments as passed to `this.notify`\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### success\n\nSet a success handler command. Will be executed with a value returned\nfrom the task, or if the task returned a Promise – with resovled value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### fail\n\nSet a fail handler command. Will be executed with error throwed in the task,\nor if the task returned a Promise – with rejected value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### multithread\n\nDefine the task to be \"multi-thread\", so every call\nwill run in parallel with other calls of the same task\nin scope of one process (model).\n\n**Parameters**\n\n-   `val` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** \n\nReturns **[TaskMeta](#taskmeta)** \n\n##### engine\n\nSet task executor function. The executor function should return an object\nthat should have at least two fields: `exec` and `cancel` functions.\n`exec` should return a promise which should be resolved or rejected\nwith an object `{ result, error }`. A `cancel` function should stop\nthe task execution.\n\n**Parameters**\n\n-   `engine` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that returns\n                               `{ exec: Function, cancel: Function }` object\n\nReturns **[TaskMeta](#taskmeta)** \n\n##### args\n\nOverride arguments which will be passed to the task\nstarting from second argument. By default a task will receive\nthe same set of arguments as a task command. If this function invoked,\nthen the task will receive given arguments instead of command arguments.\n\n**Parameters**\n\n-   `args` **...any** \n\nReturns **[TaskMeta](#taskmeta)** \n\n#### DefaultLogger\n\nA class which defins a logger for tracking command execution process.\nThe default implmenetation just defines all possible logger\nmethods (log points) and print errors to the console.\nExtend this class to define your own logging functionality\n(like logging errors with Setnry or Loggly)\n\n**Examples**\n\n```javascript\n// ./index.js\nimport { DefaultLogger, run } from 'mangojuice-core';\nimport MainBlock from './blocks/MainBlock';\n\n// Implement custom logger\nclass SetnryLogger extends DefaultLogger {\n  onCatchError(error, cmd) {\n    Raven.catchException(error);\n  }\n}\n\n// Pass instance of the Logger to `run` options object.\nrun(MainBlock, { logger: new SetnryLogger() });\n```\n\n##### onStartExec\n\nThis method invoked right before anything else - as the first thing\nin [Process#exec](#processexec). Even before any [LogicBase#hubBefore](#logicbasehubbefore).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that just started execution process\n\n##### onStartHandling\n\nInvoked right before command will go through all [LogicBase#hubBefore](#logicbasehubbefore) or [LogicBase#hubAfter](#logicbasehubafter)\nup in the blocks tree. The second argument indicates is it called for [LogicBase#hubBefore](#logicbasehubbefore)\nor for [LogicBase#hubAfter](#logicbasehubafter).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that is going to go through hubs in parent blocks\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command is going through \"after\" hubs, \"before\" otherwise\n\n##### onEndHandling\n\nInvoked when the command went through all hubs and when all sync commands\nreturned from hubs was executed.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that went through all hubs\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command going through \"after\" hubs, \"before\" otherwise\n\n##### onExecuted\n\nInvoked when the command function executed and the return of the function processed –\nall returned commands executed, all async tasks started, the model updated.\nBut it invoked before the command go through \"after\" hubs.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was exectued and the return processed\n-   `result` **any** Returned object from the command's function\n\n##### onEndExec\n\nInvoked right after the command go throught \"after\" hubs. It is the final\nstage of command execution.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was fully executed and handled by parent blocks\n\n##### onCatchError\n\nInvoked if any uncaught error happened while execution of the command\nor anywhere else in the logic, like in [LogicBase#port](#logicbaseport) or in [LogicBase#computed](#logicbasecomputed).\nBy default print the error using `console.error`.\n\n**Parameters**\n\n-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** The error instance\n-   `cmd` **[Command](#command)?** Command that was executing while the error happened\n\n#### ComputedField\n\nClass for declaring computed field with model dependencies.\nGiven array shuold contain models, binded to some\nlogec. They will be passed to compute function in the same order.\nAlso they will be used to track changed and re-compute.\n\nThe class is immutable, so any call to any method will create\na new instance of `ComputedField` and the old one won't be touched.\n\n**Parameters**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** \n\n**Properties**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** An array of models with binded logic\n                                    (attached some [Process](#process))\n-   `computeFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that will be used\n                                    to compute value of the computed field.\n\n##### compute\n\nCreates a new instance of the field and set compute function in it.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that should return a value that\n                             will be used as a value for some computed field in\n                             a model. This function will be invoked with all\n                             dependency models as arguments\n\n**Examples**\n\n```javascript\n// A way to override computed field of some base logic class\n// (thanks to immutability of `ComputedField`)\nclass MyLogic extends SomeOtherLogic {\n  computed() {\n    const oldComputed = super.computed();\n    return {\n      ...oldComputed,\n\n      // Override `oldField` compute function with saved dependencies\n      // and use overrided compute function inside new compute function\n      oldField: oldComputed.compute((...deps) => {\n        return 1 > 0 || oldComputed.oldField.computeFn(...deps);\n      })\n    };\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** New instance of the ComputedField with `computeFn`\n                         set to given function.\n\n#### Mounter\n\nTo use [mount](#mount) function you need to implement a Mounter interface\nwhich should have `mount` and `unmount` functions. It is up to the developer\nhow these functions will be implemented and what view library they will use.\n\nThere is a rule that mounter and view library should follow: view of\na model should be updated only when the model updated and the update\nshouldn't touch views of children models (children views shouldn't be updated\nbecause their models is not changed).\n\nReact perfectly fits for this rule. By implementing `shuoldComponentUpdate`\nyou can control when the component should be updated and when shouldn't. In this\ncase this function should always return `false` and componenent should be\nupdated using `forceUpdate` only when the model is updated (using [observe](#observe)).\n\n**Properties**\n\n-   `mount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that should expect two arguments: model object with\n                                  attached [Process](#process) instance and [Block#View](Block#View).\n                                  It should render the model using given View (somehow).\n-   `unmount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuold unmount mounted view from DOM.\n\n**Examples**\n\n```javascript\n// Minimal react mounter which follow the rules\nclass ViewWrapper extends React.Component {\n  componentDidMount() {\n    const { model } = this.props;\n    this.stopObserver = observe(model, () => this.forceUpdate())\n  }\n  componentWillUnmount() {\n    this.stopObserver();\n  }\n  shouldComponentUpdate() {\n    return false;\n  }\n  render() {\n    const { View, model } = this.props;\n    const Logic = logicOf(model);\n    return <View model={model} Logic={Logic} />\n  }\n}\nclass ReactMounter {\n  mount(model, View) {\n    return React.render(\n      <ViewWrapper View={View} model={model} />,\n      document.querySelector('#container')\n    );\n  }\n  unmount() {\n    return React.unmountComponentAtNode(\n      document.querySelector('#container')\n    );\n  }\n}\n```\n\n#### defineCommand\n\nProvides a way to define a command in the prototype without\nusign a decorator. You should give a prototype of the logic class,\nname of the function which should be converted to a command factory\nand the decorator function (optional).\n\nIf the decorator function is not provided, then [cmd](#cmd) will be used\nby default.\n\n**Parameters**\n\n-   `proto` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Logic class prototype\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Method name that you want to convert to a command factory\n-   `decorator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** Optional decorator function\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n  // throttle 100\n  ThrottledCommand() {\n    return this.SomeCommand();\n  }\n}\n\ndefineCommand(MyLogic.prototype, 'SomeCommand');\ndefineCommand(MyLogic.prototype, 'ThrottledCommand', cmd({ throttle: 100 }));\n```\n\n#### ensureCommand\n\nReturns a [Command](#command) instance or throw an error if given\nargument can't be used to create a [Command](#command) (is not a Command\nor command factory).\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** [Command](#command) instance or command factory. When\n                                     command factory then it will be invoked with\n                                     no arguments to create a command\n\n**Examples**\n\n```javascript\nclass MyLogic() {\n  \\@cmd SomeCommand() {\n    // do something\n  }\n}\n\nconst logic = new MyLogic();\nensureCommand(logic.SomeCommand) // returns Command instance\n// equals to...\nlogic.SomeCommand()\n```\n\nReturns **[Command](#command)** \n\n#### decorateLogic\n\nBy given logic class go through prototypes chain and\ndecorate all cmd functions. Use it if you can't use decorators\nin your project\n\nIt determine that the function should be converted to a command\nfactory (decorated by [cmd](#cmd)) by its name. If the function\nstarts with uppercase letter or underscore+upper-letter, then it\nis considered as a command.\n\n**Parameters**\n\n-   `LogicClass` **[LogicBase](#logicbase)** Logic class that you want to decorate\n-   `deep` **bool** If true then it will go though prototypes chain and\n                        decorate every prototype in the chain.\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n  }\n  _SomePrivateCommand() {\n  }\n  notACommand() {\n    return 123;\n  }\n}\n\n// `SomeCommand` and `_SomePrivateCommand` will be decorated with `cmd`\n// (the prorotype will be changed in-place). `notACommand` won't\n// be decorated.\ndecorateLogic(MyLogic);\n\nconst logic = new MyLogic();\nlogic.SomeCommand() // returns Command instance\nlogic._SomePrivateCommand() // returns Command instance\nlogic.notACommand() // returns 123\n```\n\n#### handleBefore\n\nFunction adds a handler to the [Process](#process) attached to a given\nmodel that will be invoked before every command running for this\nmodel. The handler won't be invoked for commands from children\nmodels of given model.\n\nReturns a function that removes the handler from the Process\n(stop handling)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called before every own command\n\n**Examples**\n\n```javascript\nimport { handleBefore, run, logicOf } from 'mangojuice-core';\n\n// Define root and child logic\nclass ChildLogic {\n  \\@cmd ChildCommand() {}\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  \\@cmd RootCommand() {}\n}\n\n// Run block with empty models\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ childModel: {} })\n});\n\n// Adds a handler to a root model\nhandleBefore(res.model, (cmd) => console.log(cmd));\n\n// Run commands on root and child models\nres.proc.exec(logicOf(res.model).RootCommand);\nres.proc.exec(logicOf(res.model.childModel).ChildCommand);\n\n// In the console will be printed only `RootCommand` command object\n// right before the command will be executed\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### handleAfter\n\nIt is the same as [handleBefore](#handlebefore) but the handler will be invoked\n**after** every own command.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### handle\n\nAlias for [handleAfter](#handleafter)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n#### logicOf\n\nReturns a Logic instance attached to a given model object. The logic\ninstance stored in attached [Process](#process) instance, so it execute\n[procOf](#procof) for the model to get a [Process](#process) instance and then\nget the logic instance form a Process and return it.\n\nIf Process is not attached to the model, then an Error will be throwed.\nIf the second argument passed then it will also check that the logic\ninstance is instance of some particular class.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `logicClass` **Class?** Optional logic class to check that the logic\n                                  instance is instance of the class\n\nReturns **[LogicBase](#logicbase)** Returns a logic instance\n\n#### observe\n\nA function that adds a handler to the [Process](#process) instance attached\nto a given model, that will be invoked on every command that changed\nthe model. Useful for tracking changes to re-render a view of the model.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process) instance\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be invoked after every command\n                                that changed the model.\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object with options\n    -   `options.batched` **bool** If true then the handler will be invoked only when\n                                        the commands stack is empty and model was changed during\n                                        the stack execution. Useful to reduce amount of not necessary\n                                        view re-renderings.\n\n**Examples**\n\n```javascript\nimport { run, cmd, observe, logicOf } from 'mangojuice-core';\n\nclass MyLogic {\n  \\@cmd MultipleUpdates() {\n    return [\n      this.UpdateOne,\n      this.UpdateTwo\n    ];\n  }\n  \\@cmd UpdateOne() {\n    return { one: this.model.one + 1 };\n  }\n  \\@cmd UpdateTwo() {\n    return { two: this.model.two + 1 };\n  }\n}\n\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ one: 1, two: 1 })\n});\n\nobserve(res.model, () => console.log('not-batched'));\nobserve(res.model, () => console.log('batched'), { batched: true });\n\nres.proc.exec(logicOf(res.model).MultipleUpdates);\n\n// `not-batched` will be printed two times\n// `batched` will be printed only once\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n#### procOf\n\nGet a [Process](#process) instance attached to the given model object.\nInternally it get a `__proc` field from the given model and returns it.\n\nIf given model do not have attached Process, then an Error will be throwed,\nbut only if the second argument is not true, which ignores the error.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `ignoreError` **bool** If true then no error will be throwed if Process\n                               is not attached to the model\n\nReturns **[Process](#process)** An instance of [Process](#process) attached to the model\n\n#### bind\n\nThis function do the following:\n\n-   Creates a model object using [Block#createModel](Block#createModel). It is invoked without\n    arguments.\n-   Create a [Process](#process) instance with logic from [Block#Logic](Block#Logic)\n-   Call [Process#bind](#processbind) with created model\n\nReturns an object with created process instance, model object and given block.\nUsefull when you want to prepare the block to run but you want to run it manually.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A [Block](#block) object\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options object that could change [Process](#process) behaviour (optional, default `{}`)\n    -   `opts.logger` **[DefaultLogger](#defaultlogger)?** A custom logger instance that will be used in the\n                                               Process to track commands execution. By default\n                                               [DefaultLogger](#defaultlogger) will be used.\n    -   `opts.shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object that will be available in any logic in the\n                                          tree as `this.shared`. Could be anything you want, but\n                                          you will get more benifites if you will pass model object\n                                          with attached Process as shared object to be able to make\n                                          computed fields with depending of shared model.\n    -   `opts.args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>?** An array of arguments that will be passed to [LogicBase#config](#logicbaseconfig)\n                                               of the logic.\n    -   `opts.Process` **[Process](#process)?** A class that will be used instead of [Process](#process). By default\n                                          general [Process](#process) is used, but you can customize it for your\n                                          specific needs and pass here. Then every other process in the tree\n                                          will be an instance of this custom [Process](#process) implementation\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block)}** An object with [Process](#process) instance, model object and block that was passed to\n   the function\n\n#### hydrate\n\nThis function replace a `createModel` function in given block\nwith new function that just returns a given model. It is useful\nwhen you have some old model and just want to run everytihing with\nit (for example for server rendering, or hot module replacement)\n\n**Parameters**\n\n-   `block` **[Block](#block)** An original block\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to use\n\n**Examples**\n\n```javascript\n// Hot module replacement example\nimport MyBlock from './MyBlock';\nimport { hydrate, run } from 'mangojuice-core';\n\n// Run initial block\nlet res = run(MyBlock);\n\n// When block changed destroy the old process, hydrate a new\n// block with existing model and run hydrated new block again\nmodule.hot.accept(['./MyBlock'], () => {\n  res.proc.destroy();\n  const newBlock = hydrate(require('./MyBlock'), res.model);\n  res = run(newBlock);\n});\n```\n\nReturns **[Block](#block)** A new block with replaced `createModel` function\n                 which just returns a model that you passed as\n                 second argument.\n\n#### delay\n\nA helper function for delaying execution. Returns a Promise\nwhich will be resolved in given amount of milliseconds. You can\nuse it in [task](#task) to implement some delay in execution, for\ndebouncing for example.\n\n**Parameters**\n\n-   `ms` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** An amount of milliseconds to wait\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that resolved after given amount of milliseconds\n\n## Basic\n\nThe most common APIs that you will work with most of the time\n\n### Block\n\nBlock is a top level component in MangoJuice which consists of three parts:\n\n-   Model factory function `createModel` which should return a plain object.\n    The main requirement for this function is that it should be able to return\n    some model with zero arguments. But it can also accept some arguments\n    as well.\n-   A logic class which implements [LogicBase](#logicbase) interface\n-   A View function which is aimed to render the model created by `createModel`\n\nThe View part is optional and it could have different type depending on\nselected View library to render a model and particular binding library.\n\n**Properties**\n\n-   `Logic` **[LogicBase](#logicbase)** A logic class that should be attached to the model.\n-   `createModel` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuld return a plain object which\n                                      will be an init model of the block.\n-   `View` **any?** Something that some particular view library can render\n\n**Examples**\n\n```javascript\n// You can define block in short way using an object\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nrun(MyBlock);\n```\n\n```javascript\n// Or you can split it with modules (recommended)\n// ./MyBlock/index.js\nimport Logic from './Logic';\nimport View from './View';\nimport { createModel } from './Model';\nexport default { View, Logic, createModel };\nexport { View, Logic, createModel };\nexport type { Model } from './Model';\n\n// ./MyBlock/Logic.js\nimport type { Model } from './Model';\nimport { LogicBase, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  \\@cmd SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n}\n\n// ./MyBlock/Model.js\nexport type Model = { field: number };\nexport const createModel = () => ({\n  field: 1\n});\n\n// ./MyBlock/View.js\nconst MyBlockView = ({ model }) => (\n  <div>{model.field}</div>\n);\nexport default MyBlockView;\n\n// ./index.js\nimport MyBlock from './MyBlock';\nimport { run } from 'mangojuice-core';\n\nrun(MyBlock);\n```\n\n### LogicBase\n\nBasic class for every logic. It is not necessaty to inherit an actual logic\nclass from it, but for better type-checking it could be really usefull.\n\nLogic class defines:\n\n-   A set of commands that could change an associated model – methods decorated with [cmd](#cmd)\n-   What fields of the model should be associated with which logic class\n    (children blocks) – [LogicBase#children](#logicbasechildren) method\n-   A set of computed model fields – [LogicBase#computed](#logicbasecomputed) method\n-   A set of rules to handle commands from children logic – [LogicBase#hubAfter](#logicbasehubafter)\n    and [LogicBase#hubBefore](#logicbasehubbefore) methods\n-   A logic to handle external events – [LogicBase#port](#logicbaseport) method.\n\nThe logic class defines all the business-logic of some part of your application.\nThe main goal of the logic – change associated model. Check [cmd](#cmd) and [Process#exec](#processexec)\nto have a better understanding how command can be defined and how it is executed.\n\n**Properties**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object which is associated with the\n                               logic class in parent logic.\n-   `meta` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object defined in [LogicBase#config](#logicbaseconfig) method for storing\n                               some internal logic state.\n-   `shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object with some shared state, defined while\n                               run process of the app.\n\n**Examples**\n\n```javascript\n// ./blocks/MyBlock/Logic.js\n// @flow\nimport type { Model } from './Model';\nimport ChildBlock from '../ChildBlock';\nimport { Command, cmd } from 'mangojuice-core';\n\nexport default class MyLogic extends LogicBase<Model> {\n  children() {\n    return { child: ChildBlock.Logic };\n  }\n  hubAfter(cmd: Command) {\n    if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n      return this.TestCommand(123);\n    }\n  }\n  \\@cmd TestCommand(arg) {\n    return { field: arg + this.model.field };\n  }\n}\n```\n\n#### config\n\nA function that defines init commands and meta object of the\nlogic. Can accept any type and number of arguments. Config\nwill take arguments passed to [child](#child) function (for example\n`child(MyLogic, 1, 2, 3)` defines that the `config` method of\n`MyLogic` will be invoked like `config(1, 2, 3)`)\n\nCould return an object with the fields:\n\n-   `initCommands` which could be an array or a single Command,\n    that will be executed every time when the logic instance created\n    and associated with some model (when [Process#run](#processrun) invoked)\n-   `meta` which could be an object with some internal state of\n    the logic\n\n**Examples**\n\n```javascript\nconfig(props) {\n  return {\n    initCommands: [ this.StartThis, this.SendThat(123) ],\n    meta: { something: props.amount }\n  };\n}\n```\n\n#### children\n\nThis function defines what logic class should be associated\nwith which model field. Should return an object where a key is\na model field name, and a value is a logic class or an object\nthat defines logic with arguments (return from [child](#child) function)\n\n**Examples**\n\n```javascript\nchildren() {\n  return {\n    searchForm: child(SearchForm.Logic, { timeout: 100 }),\n    searchResults: SearchResults.Logic\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n#### computed\n\nShould return an object which defines computed fields of the model.\nA key of the object is a model field, and value is a function or\ncomputed function definition object (return from [depends](#depends) function).\n\nComputed field is lazy, which means that it is computed on the first use\nof the field and the computation result cached until the next update\nof the model.\n\nIf you want to define a computed field which ueses in computation not\nonly fields from the own model, but maybe some values from child model,\nor from shared model, then you will need to use [depends](#depends) function to\ndefine what models used while computation to observe changes of these\nmodels to trigger an update event of the own model (to update views).\n\n**Examples**\n\n```javascript\ncomputed() {\n  return {\n    simple: () => this.model.a + this.model.b,\n    withDeps: depends(this.model.child, this.shared).compute(() => {\n      return this.model.child.a + this.shared.b + this.model.c;\n    })\n  };\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n#### port\n\nA function to handle global event, such as browser-level events,\nwebsocket, intervals. The main porpouse of the `port` is to subscribe\nto some global events, execute appropriate commands from the logic\non the events and remove the handlers when the logic was destroyed.\n\n**Parameters**\n\n-   `exec` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** It is a function that execute a passed command\n-   `destroyed` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that will be resolved when the logic destroyed\n\n**Examples**\n\n```javascript\nport(exec, destroyed) {\n  const timer = setInterval(() => {\n    exec(this.SecondPassed);\n  }, 1000);\n  destroyed.then(() => clearInterval(timer));\n}\n```\n\n#### hubAfter\n\nHub for all commands executed in the children blocks. The only\narguments is a command object that was executed.\nCould return a Command or an array of Commands that should\nbe executed next.\nMost of the time this function will look like a `switch`,\nbut maybe with some additional rules for the cases. Take a look\nto [Command#is](#commandis) function to have a better understanding how you\ncan determine that the command is exactly what you are waiting for.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was executed in some child logic\n                           or in any child of the child and so on down to\n                           the leaf of the tree.\n\n**Examples**\n\n```javascript\nhubAfter(cmd) {\n  if (cmd.is(ChildBlock.Logic.prototype.SomeCommand)) {\n    return this.HandlerCommand(123);\n  }\n  if (cmd.is('AnotherChild.SomeAnothercommand')) {\n    return [ this.HandlerCommand(321), this.AnotherHandler ];\n  }\n}\n```\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)**\n\n#### hubBefore\n\nSame as [LogicBase#hubAfter](#logicbasehubafter), but catch commands before\nit will be actually executed, so you can compare prev and next\nmodel state for example.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **([Command](#command)? | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Command](#command)>?)**\n\n### cmd\n\nDecorator that converts a logic method to a command factory.\nThe result function (command factory function) is a function\nthat return a [Command](#command) instnace with the decorated function\nand arguments that you will pass to a command factory function.\n\nYou can use this decorator without arguments or with an options\nargument (object)\n\nCheck [Process#exec](#processexec) to see what the origin function\ncould return to do something. If in short, it can return:\nnothing, command (or factory or array of commands), task,\nmodel update object.\n\n**Parameters**\n\n-   `obj` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** If only this argument passed then it will be considered\n                                   as options object which can customize command behaviour.\n    -   `obj.debounce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be debounced by given amount of\n                                       milliseconds\n    -   `obj.throttle` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** If greeter than zero then an exeuction\n                                       of the command will be throttled by given amount of\n                                       milliseconds\n    -   `obj.noInitCall` **bool** If true then debounced/throttled execution\n                                       won't start with init command call. By default\n                                       debounced/throttled command will be instantly\n                                       exected and only then wait for a chance to execute\n                                       again. With `noInitCall=true` there is no instant init\n                                       command call.\n    -   `obj.internal` **bool** Make the command invisible for parent [LogicBase#hubBefore](#logicbasehubbefore)\n                                       and [LogicBase#hubAfter](#logicbasehubafter). Use it for commands that shouldn't\n                                       be handled by hubs to increse performance.\n    -   `obj.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** By default name of the command taken from origin function. With this\n                                       option you can override the name with any other value.\n-   `methodName`\n-   `descr`\n\n**Examples**\n\n```javascript\nclass RegularLogic {\n  \\@cmd RegularCommand() {\n    // do something\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ debounce: 300 })\n  DebouncedCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 600ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300 })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 2 times,\n    // first right when you call it for a first time,\n    // and second in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ throttle: 300, noInitCall: true })\n  ThrottledCommand() {\n    // if you will call this command 3 times every\n    // 100ms then it will be executed 1 time in 300ms.\n  }\n}\n```\n\n```javascript\nclass RegularLogic {\n  \\@cmd({ internal: true })\n  _InternalCommand() {\n    // this command can't be caught in `hubBefore` or `hubAfter`\n    // in parent logics. Use it carefully.\n  }\n}\n```\n\nReturns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory function (if all three arguemnts passed)\n                               or a decorator function with binded options object\n                               (that you pass as a first argument)\n\n### run\n\nRun given block. It is a short-hand function for running [bind](#bind)\nand then running a Process by [Process#run](#processrun).\nAlso it returns an additional `finished` Promise which is resolved\nwhen all async tasks finished and all handler commands executed.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A block that you wan to run\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Same options as in [bind](#bind) (optional, default `{}`)\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block), finished: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)}** An object\n                 which is almost the same as returned from [bind](#bind), but with\n                 additional `finished` field, which is a Promise that will be resolved\n                 when all blocks will execute all commands and all async tasks will be\n                 finished.\n\n### mount\n\nMount running block. As third and next arguments you can pass other running\nblocks which will be stopped with the main running block (useful for HMR).\n\n**Parameters**\n\n-   `mounter` **[Mounter](#mounter)** An implementation of [Mounter](#mounter) interface\n-   `runRes` **{proc: [Process](#process), block: [Block](#block), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)}** An object that returned\n                     from [run](#run) function.\n-   `otherBlocks` **...any**\n\n**Examples**\n\n```javascript\nconst MyBlock = {\n  createModel: () => ({ field: 1 }),\n  Logic: class MyLogic {\n    \\@cmd SomeCommand() {\n      return { field: this.model.field + 1 };\n    }\n  },\n  View: ({ model }) => (\n    <div>{model.field}</div>\n  )\n};\n\nmount(new ReactMounter(), run(MyBlock));\n```\n\nReturns **{view: any, stop: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)}** An object with the result form [Mounter#mount](Mounter#mount)\n                 function (in `view` field) and stop function which destroy the process and\n                 unmount a view using [Mounter#unmount](Mounter#unmount)\n\n### task\n\nCreates a [TaskMeta](#taskmeta) object that could be returned from\nasync task command. It describes the task that should be executed.\n\nFor more information what the **Task** is and how it should be implemented\ntake a look to [TaskMeta](#taskmeta).\n\n**Parameters**\n\n-   `taskFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that could return a Promise\n\n**Properties**\n\n-   `CANCEL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A symbol that you can use to make a promise \"cancellable\"\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n### cancel\n\nThis function should be used to cancel async [task](#task) execution.\nAlso it can cancel the debounced/throttled command.\n\n-   In case with task, if task was executing while you call a cancel command,\n    the task will be cancelled (execution stopped). Otherwise nothing will happen.\n-   In case with debounced/throttled command, if the command scheduled to be executed\n    then the schedule timer will be cleared and the command won't be executed.\n    If the command is not scheduled then nothing happens.\n\nTo use it just pass a command or command factory as a first argument\nand return it from some other command.\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Command or command factory that you wan to cancel. Could\n                                    be a command that returns [task](#task) or debounced/throttled\n                                    command\n\n**Examples**\n\n```javascript\nclass SomeLogic {\n  \\@cmd CancelSomethingCommand() {\n    return [\n      cancel(this.TaskCommand),\n      cancel(this.DebounceCommand)\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask);\n  }\n  \\@cmd({ debounce: 300 })\n  DebounceCommand() {\n    // do something\n  }\n}\n```\n\nReturns **[Command](#command)** Returns a new command that will cancel the execution of the command\n                  passed as an argument.\n\n### child\n\nCreates an object which describes child logic which will be attached\nto some model field. Should be used in [LogicBase#children](#logicbasechildren) to\ndefine a logic that should be instantiated with some arguments passed\nto [LogicBase#config](#logicbaseconfig).\n\n**Parameters**\n\n-   `logicClass` **[LogicBase](#logicbase)** Class that imlements [LogicBase](#logicbase) interface\n-   `args` **...any**\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  config(amount) {\n    return { meta: { amount } };\n  }\n}\nclass RootLogic {\n  children() {\n    return {\n      modelField: child(ChildLogic, 10)\n      // `config` of `ChildLogic` will be invoked with\n      // `10` as a first argument\n    }\n  }\n}\n```\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object that contains a logic class and an arguments array that\n                 should be used to invoke `config` method of provided logic class.\n\n### depends\n\nFunction that helps to describe a computed field with external\nmodel dependncies. Should be used in [LogicBase#computed](#logicbasecomputed).\nIt creates an instance of [ComputedField](#computedfield) with dependencies\npassed as arguments.\n\nA compute field with external dependencies is a field that should\nbe updated (re-computed) not only when the own model udpated, but\nalso when depdendency models updated.\n\n**Parameters**\n\n-   `deps` **...deps** A list of models with attached logic\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  // some logic\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  computed() {\n    return {\n      // depends on `childModel`\n      computedField: depends(this.model.childModel).compute(() => {\n        return this.model.a + this.model.childModel.b;\n      }),\n\n      // depends on `shared` model\n      computeWithShared: depends(this.shared).compute(() => {\n        return this.model.b + this.shared.someField;\n      })\n    }\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)**\n\n## Extras\n\nOther pieces of MangoJuice\n\n### Process\n\nThe main class of MangoJuice that ties model, logic and view together.\n\nIt works in the following way:\n\n-   You create a model for your app (object) using `createModel` of\n    the root block. The result is a plain object.\n-   Then you need to create an instance of Process and pass logic class\n    in the options object.\n-   Then you `bind` the Process instance to the model object you created on step one.\n    \"To bind Process to a model\" means that in the model will be created a hidden\n    field `__proc` with a reference to the Process instance.\n-   After that you can `run` the Process, which will execute init commands, port.\n\n`bind` and `run` also look at the object returned from [LogicBase#children](#logicbasechildren)\nand create/run Process instances for children models.\n\nMost of the time you do not need to care about all of these and just use\n[run](#run) and [mount](#mount). These small functions do everything described\nabove for you.\n\n**Examples**\n\n```javascript\nimport { Process, logicOf } from 'mangojuice-core';\n\nconst ExampleBlock = {\n  createModel() {\n    return { a: 10 };\n  },\n  Logic: class Example {\n    \\@cmd Increment(amount = 1) {\n      return { a: this.model.a + amount };\n    }\n  }\n};\n\nconst model = ExampleBlock.createModel();\nconst proc = new Process({ logic: ExampleBlock.Logic });\nproc.bind(model);\nproc.run();\nproc.exec(logicOf(model).Increment(23));\n```\n\n#### bind\n\nBind the process instance to a given model, which means that hidden\n`__proc` field will be created in the model with a reference to the\nProcess instance.\n\nAlso bind all children models – go through children definition returned\nby [LogicBase#children](#logicbasechildren), create Process for each child and bind\nit to an appropreat child model object.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to bind to the Process.\n\n#### run\n\nRun the process – run children processes, then run port and\ninit commands defined in config.\nAlso run all model observers created by [observe](#observe)\n\n#### destroy\n\nDestroy the process with unbinding from the model and cleaning\nup all the parts of the process (stop ports, computed fields).\n`__proc` field will be removed from the model object and all\nchildren objects.\n\n**Parameters**\n\n-   `deep` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then all children blocks will be destroyed.\n                             By default, if not provided then considered as true.\n\n#### exec\n\nExec a command in scope of the Process instance.\nIt will use binded model and logic object to run the\ncommand. The command could be function (command factory)\nor object ([Command](#command) instance).\n\nA command origin function could return three types of things:\n\n-   Another [Command](#command)/command factory or an array of commands\n    (an element of the array also could be another array with commands\n    or null/undefined/false). All commands will be execute in provided order.\n-   An instance of [TaskMeta](#taskmeta) (which is usually created by [task](#task)\n    helper function). The returned task will be started and do not block\n    execution of next commands in the stack.\n-   A plain object which is a model update object. The object will be merged\n    with current model.\n\nIf command is undefined or `Process` instance not binded\nto any model it will do nothing.\n\n**Parameters**\n\n-   `cmd` **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** Command factory or Command instance\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  \\@cmd BatchCommand() {\n    return [\n      1 > 2 && this.SomeCoomand,\n      this.AnotheCommand(123),\n      2 > 1 && [\n        this.AndSomeOtherCommand,\n        this.FinalCommand()\n      ]\n    ];\n  }\n  \\@cmd TaskCommand() {\n    return task(Tasks.SomeTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n  }\n  \\@cmd ModelUpdateCommand() {\n    if (Math.random() > 0.6) {\n      return { field: Date.now() };\n    }\n  }\n}\n```\n\n#### finished\n\nReturns a promise which will be resolved when all async\ntasks and related handlers in the process and all children\nprocesses will be finished.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**\n\n### Command\n\nClass which declares a command that will be executed in the\nfuture by some [Process#exec](#processexec). It contains a function that will be\nexecuted, arguments that should be passed to the function\nand command name.\n\nThe command also keep a context that should be used to execute\na function. Usually this context is some logic instance. You\ncan bind a context to the command using [Command#bind](#commandbind) function.\n\nThe command instance is immutable, so any function that\nmakes some change in the command will produce a new command\ninstead of changing the original one.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>**\n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n\n**Properties**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** An origin function that should be executed\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** A set of arguments that should be used\n                                 to execute the fucntion.\n\n#### exec\n\nExecute a function stored in the command instance. It passes\nstored arguments to the function and call it in stored context.\nReturns the value that was returned form the function.\n\nReturns **any**\n\n#### clone\n\nClone instance of the command\n\nReturns **[Command](#command)**\n\n#### is\n\nCheck is the command equal to some other command or have\na reference to the same origin function. Optionally you can also\ncheck that the command binded to some concrete model (using\nthe second argument).\n\nYou can use many different formats to define the command to check:\n\n-   Just a string, which should be constructed like\n    `Logic Class Name + Function Name`\n-   Command object or command factory that you can get from prorotype\n    of some logic class.\n-   Binded command object or command factory that you can get from\n    concrete model using [logicOf](#logicof) function\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Command object or command factory or command name\n-   `childModel` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Model object that should be binded to the command (optional)\n\n**Examples**\n\n```javascript\nclass ChildLogic {\n  \\@cmd SomeCommand() {}\n}\nclass MyLogic {\n  hubAfter(cmd) {\n    if (cmd.is('ChildLogic.SomeCommand')) {\n      // by command name\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand)) {\n      // by command factory\n    }\n    if (cmd.is(logicOf(this.model.child).SomeCommand)) {\n      // by binded to a concrete model command factory (commands\n      // binded for other models will be ignored)\n    }\n    if (cmd.is(ChildLogic.prorotype.SomeCommand, this.model.child)) {\n      // by command factory and concrete child model (commands\n      // binded for other models will be ignored)\n    }\n  }\n}\n```\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the command have same name, or same origin function\n                                and binded to same model (if second argument provided)\n\n#### appendArgs\n\nCreates a new Command instance (clone the command) and append\ngiven list of arguments to the current list of arguments.\nReturns a new Command with new list of arguments.\n\n**Parameters**\n\n-   `args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of arguments that will be appened\n                               to tne new Command\n\nReturns **[Command](#command)** New command with appended arguments\n\n#### bind\n\nCreates a new Command instance and set given logic instance in it.\nAlso update command name by name of the origin function and name\nof the logic class.\n\n**Parameters**\n\n-   `logic` **[LogicBase](#logicbase)** A logic instance that should be binded to a command\n\nReturns **[Command](#command)** New command binded to given logic instance\n\n### TaskMeta\n\nClass for declaring an async task. An instance of this object returned\nfrom [taks](taks) function.\n\nA task function is a function that could return a Promise. The resolved value\nwill be passed to a success command handler, the rejected command will be passed\nto a fail command handler.\n\nIf task function do not return a Promise, then the returned value passed to a\nsuccess command, and if the function throw an error then the error passed to\na fail command.\n\nThe task function receive at least one argument – an object with `model`, `shared`\nand `meta`. All the next arguments will be given from a command that returned a task,\nif it is not overrided by [TaskMeta#args](#taskmetaargs)\n\nBy default a task is single-threaded. It means that every call to a task will cancel\npreviously running task if it is running. You can make the task to be multi-threaded\nby [TaskMeta#multithread](#taskmetamultithread), so every call to a task won't cancel the running one.\n\nIn a context of the task function defined special `call` function. This function should\nbe used to invoke sub-tasks. It is important to use `call` to run sub-tasks because\n`call` create a cancellation point of the task – if the task cancelled, then nothing\nwill be executed after currently running `call` sub-task.\n\n`call` returns an object with `result` and `error` fields. If `error` field is not\nempty, then something weird happened in the sub-task. `call` internally have a try/catch,\nso it is not necessary to wrap it with try/catch, just check the `error` field in the\nreturned object and if it is not empty – handle it somehow (throw it, or do any custom\nerror handling)\n\nAlso in a context of the task defined a `notify` function. It is a function that execute\nnotify command if it is defined. The command executed with the same arguments as passed\nto `notify` function. You can use it to incrementally update a model while the long\ntask is executing, to show some progress for the user.\n\n**Parameters**\n\n-   `taskFn` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n-   `executor` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n\n**Examples**\n\n```javascript\nasync function SubTask(a, b, c) {\n  this.notify(a + b + c);\n  await this.call(delay, 100);\n  return (a / b * c);\n}\nasync function RootTask({ model }) {\n  const { result, error } = await this.call(SubTask, 1, 0, 3);\n  if (error) {\n    throw new Error('Something weird happened in subtask')\n  }\n  return result + 10;\n}\n```\n\n```javascript\nclass MyLogic {\n  \\@cmd AsyncCommand() {\n    return task(Tasks.RootTask)\n      .success(this.SuccessCommand)\n      .fail(this.FailCommand)\n      .notify(this.NotifyCommand)\n  }\n}\n```\n\n#### notify\n\nSet a notify handler command. This command executed by call of `this.notify`\ninside a task with the same arguments as passed to `this.notify`\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### success\n\nSet a success handler command. Will be executed with a value returned\nfrom the task, or if the task returned a Promise – with resovled value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### fail\n\nSet a fail handler command. Will be executed with error throwed in the task,\nor if the task returned a Promise – with rejected value.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### multithread\n\nDefine the task to be \"multi-thread\", so every call\nwill run in parallel with other calls of the same task\nin scope of one process (model).\n\n**Parameters**\n\n-   `val` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### engine\n\nSet task executor function. The executor function should return an object\nthat should have at least two fields: `exec` and `cancel` functions.\n`exec` should return a promise which should be resolved or rejected\nwith an object `{ result, error }`. A `cancel` function should stop\nthe task execution.\n\n**Parameters**\n\n-   `engine` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that returns\n                               `{ exec: Function, cancel: Function }` object\n\nReturns **[TaskMeta](#taskmeta)**\n\n#### args\n\nOverride arguments which will be passed to the task\nstarting from second argument. By default a task will receive\nthe same set of arguments as a task command. If this function invoked,\nthen the task will receive given arguments instead of command arguments.\n\n**Parameters**\n\n-   `args` **...any**\n\nReturns **[TaskMeta](#taskmeta)**\n\n### DefaultLogger\n\nA class which defins a logger for tracking command execution process.\nThe default implmenetation just defines all possible logger\nmethods (log points) and print errors to the console.\nExtend this class to define your own logging functionality\n(like logging errors with Setnry or Loggly)\n\n**Examples**\n\n```javascript\n// ./index.js\nimport { DefaultLogger, run } from 'mangojuice-core';\nimport MainBlock from './blocks/MainBlock';\n\n// Implement custom logger\nclass SetnryLogger extends DefaultLogger {\n  onCatchError(error, cmd) {\n    Raven.catchException(error);\n  }\n}\n\n// Pass instance of the Logger to `run` options object.\nrun(MainBlock, { logger: new SetnryLogger() });\n```\n\n#### onStartExec\n\nThis method invoked right before anything else - as the first thing\nin [Process#exec](#processexec). Even before any [LogicBase#hubBefore](#logicbasehubbefore).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that just started execution process\n\n#### onStartHandling\n\nInvoked right before command will go through all [LogicBase#hubBefore](#logicbasehubbefore) or [LogicBase#hubAfter](#logicbasehubafter)\nup in the blocks tree. The second argument indicates is it called for [LogicBase#hubBefore](#logicbasehubbefore)\nor for [LogicBase#hubAfter](#logicbasehubafter).\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that is going to go through hubs in parent blocks\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command is going through \"after\" hubs, \"before\" otherwise\n\n#### onEndHandling\n\nInvoked when the command went through all hubs and when all sync commands\nreturned from hubs was executed.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that went through all hubs\n-   `isAfter` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true then the command going through \"after\" hubs, \"before\" otherwise\n\n#### onExecuted\n\nInvoked when the command function executed and the return of the function processed –\nall returned commands executed, all async tasks started, the model updated.\nBut it invoked before the command go through \"after\" hubs.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was exectued and the return processed\n-   `result` **any** Returned object from the command's function\n\n#### onEndExec\n\nInvoked right after the command go throught \"after\" hubs. It is the final\nstage of command execution.\n\n**Parameters**\n\n-   `cmd` **[Command](#command)** Command that was fully executed and handled by parent blocks\n\n#### onCatchError\n\nInvoked if any uncaught error happened while execution of the command\nor anywhere else in the logic, like in [LogicBase#port](#logicbaseport) or in [LogicBase#computed](#logicbasecomputed).\nBy default print the error using `console.error`.\n\n**Parameters**\n\n-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** The error instance\n-   `cmd` **[Command](#command)?** Command that was executing while the error happened\n\n### ComputedField\n\nClass for declaring computed field with model dependencies.\nGiven array shuold contain models, binded to some\nlogec. They will be passed to compute function in the same order.\nAlso they will be used to track changed and re-compute.\n\nThe class is immutable, so any call to any method will create\na new instance of `ComputedField` and the old one won't be touched.\n\n**Parameters**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**\n\n**Properties**\n\n-   `deps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** An array of models with binded logic\n                                    (attached some [Process](#process))\n-   `computeFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that will be used\n                                    to compute value of the computed field.\n\n#### compute\n\nCreates a new instance of the field and set compute function in it.\n\n**Parameters**\n\n-   `func` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A compute function that should return a value that\n                             will be used as a value for some computed field in\n                             a model. This function will be invoked with all\n                             dependency models as arguments\n\n**Examples**\n\n```javascript\n// A way to override computed field of some base logic class\n// (thanks to immutability of `ComputedField`)\nclass MyLogic extends SomeOtherLogic {\n  computed() {\n    const oldComputed = super.computed();\n    return {\n      ...oldComputed,\n\n      // Override `oldField` compute function with saved dependencies\n      // and use overrided compute function inside new compute function\n      oldField: oldComputed.compute((...deps) => {\n        return 1 > 0 || oldComputed.oldField.computeFn(...deps);\n      })\n    };\n  }\n}\n```\n\nReturns **[ComputedField](#computedfield)** New instance of the ComputedField with `computeFn`\n                         set to given function.\n\n### Mounter\n\nTo use [mount](#mount) function you need to implement a Mounter interface\nwhich should have `mount` and `unmount` functions. It is up to the developer\nhow these functions will be implemented and what view library they will use.\n\nThere is a rule that mounter and view library should follow: view of\na model should be updated only when the model updated and the update\nshouldn't touch views of children models (children views shouldn't be updated\nbecause their models is not changed).\n\nReact perfectly fits for this rule. By implementing `shuoldComponentUpdate`\nyou can control when the component should be updated and when shouldn't. In this\ncase this function should always return `false` and componenent should be\nupdated using `forceUpdate` only when the model is updated (using [observe](#observe)).\n\n**Properties**\n\n-   `mount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that should expect two arguments: model object with\n                                  attached [Process](#process) instance and [Block#View](Block#View).\n                                  It should render the model using given View (somehow).\n-   `unmount` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that shuold unmount mounted view from DOM.\n\n**Examples**\n\n```javascript\n// Minimal react mounter which follow the rules\nclass ViewWrapper extends React.Component {\n  componentDidMount() {\n    const { model } = this.props;\n    this.stopObserver = observe(model, () => this.forceUpdate())\n  }\n  componentWillUnmount() {\n    this.stopObserver();\n  }\n  shouldComponentUpdate() {\n    return false;\n  }\n  render() {\n    const { View, model } = this.props;\n    const Logic = logicOf(model);\n    return <View model={model} Logic={Logic} />\n  }\n}\nclass ReactMounter {\n  mount(model, View) {\n    return React.render(\n      <ViewWrapper View={View} model={model} />,\n      document.querySelector('#container')\n    );\n  }\n  unmount() {\n    return React.unmountComponentAtNode(\n      document.querySelector('#container')\n    );\n  }\n}\n```\n\n### defineCommand\n\nProvides a way to define a command in the prototype without\nusign a decorator. You should give a prototype of the logic class,\nname of the function which should be converted to a command factory\nand the decorator function (optional).\n\nIf the decorator function is not provided, then [cmd](#cmd) will be used\nby default.\n\n**Parameters**\n\n-   `proto` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Logic class prototype\n-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Method name that you want to convert to a command factory\n-   `decorator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** Optional decorator function\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n    return { field: this.model.field + 1 };\n  }\n  // throttle 100\n  ThrottledCommand() {\n    return this.SomeCommand();\n  }\n}\n\ndefineCommand(MyLogic.prototype, 'SomeCommand');\ndefineCommand(MyLogic.prototype, 'ThrottledCommand', cmd({ throttle: 100 }));\n```\n\n### ensureCommand\n\nReturns a [Command](#command) instance or throw an error if given\nargument can't be used to create a [Command](#command) (is not a Command\nor command factory).\n\n**Parameters**\n\n-   `cmd` **([Command](#command) \\| [function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** [Command](#command) instance or command factory. When\n                                     command factory then it will be invoked with\n                                     no arguments to create a command\n\n**Examples**\n\n```javascript\nclass MyLogic() {\n  \\@cmd SomeCommand() {\n    // do something\n  }\n}\n\nconst logic = new MyLogic();\nensureCommand(logic.SomeCommand) // returns Command instance\n// equals to...\nlogic.SomeCommand()\n```\n\nReturns **[Command](#command)**\n\n### decorateLogic\n\nBy given logic class go through prototypes chain and\ndecorate all cmd functions. Use it if you can't use decorators\nin your project\n\nIt determine that the function should be converted to a command\nfactory (decorated by [cmd](#cmd)) by its name. If the function\nstarts with uppercase letter or underscore+upper-letter, then it\nis considered as a command.\n\n**Parameters**\n\n-   `LogicClass` **[LogicBase](#logicbase)** Logic class that you want to decorate\n-   `deep` **bool** If true then it will go though prototypes chain and\n                        decorate every prototype in the chain.\n\n**Examples**\n\n```javascript\nclass MyLogic {\n  SomeCommand() {\n  }\n  _SomePrivateCommand() {\n  }\n  notACommand() {\n    return 123;\n  }\n}\n\n// `SomeCommand` and `_SomePrivateCommand` will be decorated with `cmd`\n// (the prorotype will be changed in-place). `notACommand` won't\n// be decorated.\ndecorateLogic(MyLogic);\n\nconst logic = new MyLogic();\nlogic.SomeCommand() // returns Command instance\nlogic._SomePrivateCommand() // returns Command instance\nlogic.notACommand() // returns 123\n```\n\n### handleBefore\n\nFunction adds a handler to the [Process](#process) attached to a given\nmodel that will be invoked before every command running for this\nmodel. The handler won't be invoked for commands from children\nmodels of given model.\n\nReturns a function that removes the handler from the Process\n(stop handling)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called before every own command\n\n**Examples**\n\n```javascript\nimport { handleBefore, run, logicOf } from 'mangojuice-core';\n\n// Define root and child logic\nclass ChildLogic {\n  \\@cmd ChildCommand() {}\n}\nclass MyLogic {\n  children() {\n    return { childModel: ChildLogic };\n  }\n  \\@cmd RootCommand() {}\n}\n\n// Run block with empty models\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ childModel: {} })\n});\n\n// Adds a handler to a root model\nhandleBefore(res.model, (cmd) => console.log(cmd));\n\n// Run commands on root and child models\nres.proc.exec(logicOf(res.model).RootCommand);\nres.proc.exec(logicOf(res.model.childModel).ChildCommand);\n\n// In the console will be printed only `RootCommand` command object\n// right before the command will be executed\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### handleAfter\n\nIt is the same as [handleBefore](#handlebefore) but the handler will be invoked\n**after** every own command.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### handle\n\nAlias for [handleAfter](#handleafter)\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object with attached [Process](#process)\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be called after every own command\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that stopps the handler\n\n### logicOf\n\nReturns a Logic instance attached to a given model object. The logic\ninstance stored in attached [Process](#process) instance, so it execute\n[procOf](#procof) for the model to get a [Process](#process) instance and then\nget the logic instance form a Process and return it.\n\nIf Process is not attached to the model, then an Error will be throwed.\nIf the second argument passed then it will also check that the logic\ninstance is instance of some particular class.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `logicClass` **Class?** Optional logic class to check that the logic\n                                  instance is instance of the class\n\nReturns **[LogicBase](#logicbase)** Returns a logic instance\n\n### observe\n\nA function that adds a handler to the [Process](#process) instance attached\nto a given model, that will be invoked on every command that changed\nthe model. Useful for tracking changes to re-render a view of the model.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process) instance\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** A function that will be invoked after every command\n                                that changed the model.\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object with options\n    -   `options.batched` **bool** If true then the handler will be invoked only when\n                                        the commands stack is empty and model was changed during\n                                        the stack execution. Useful to reduce amount of not necessary\n                                        view re-renderings.\n\n**Examples**\n\n```javascript\nimport { run, cmd, observe, logicOf } from 'mangojuice-core';\n\nclass MyLogic {\n  \\@cmd MultipleUpdates() {\n    return [\n      this.UpdateOne,\n      this.UpdateTwo\n    ];\n  }\n  \\@cmd UpdateOne() {\n    return { one: this.model.one + 1 };\n  }\n  \\@cmd UpdateTwo() {\n    return { two: this.model.two + 1 };\n  }\n}\n\nconst res = run({\n  Logic: MyLogic,\n  createModel: () => ({ one: 1, two: 1 })\n});\n\nobserve(res.model, () => console.log('not-batched'));\nobserve(res.model, () => console.log('batched'), { batched: true });\n\nres.proc.exec(logicOf(res.model).MultipleUpdates);\n\n// `not-batched` will be printed two times\n// `batched` will be printed only once\n```\n\nReturns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\n\n### procOf\n\nGet a [Process](#process) instance attached to the given model object.\nInternally it get a `__proc` field from the given model and returns it.\n\nIf given model do not have attached Process, then an Error will be throwed,\nbut only if the second argument is not true, which ignores the error.\n\n**Parameters**\n\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model with attached [Process](#process)\n-   `ignoreError` **bool** If true then no error will be throwed if Process\n                               is not attached to the model\n\nReturns **[Process](#process)** An instance of [Process](#process) attached to the model\n\n### bind\n\nThis function do the following:\n\n-   Creates a model object using [Block#createModel](Block#createModel). It is invoked without\n    arguments.\n-   Create a [Process](#process) instance with logic from [Block#Logic](Block#Logic)\n-   Call [Process#bind](#processbind) with created model\n\nReturns an object with created process instance, model object and given block.\nUsefull when you want to prepare the block to run but you want to run it manually.\n\n**Parameters**\n\n-   `block` **[Block](#block)** A [Block](#block) object\n-   `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options object that could change [Process](#process) behaviour (optional, default `{}`)\n    -   `opts.logger` **[DefaultLogger](#defaultlogger)?** A custom logger instance that will be used in the\n                                               Process to track commands execution. By default\n                                               [DefaultLogger](#defaultlogger) will be used.\n    -   `opts.shared` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** An object that will be available in any logic in the\n                                          tree as `this.shared`. Could be anything you want, but\n                                          you will get more benifites if you will pass model object\n                                          with attached Process as shared object to be able to make\n                                          computed fields with depending of shared model.\n    -   `opts.args` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>?** An array of arguments that will be passed to [LogicBase#config](#logicbaseconfig)\n                                               of the logic.\n    -   `opts.Process` **[Process](#process)?** A class that will be used instead of [Process](#process). By default\n                                          general [Process](#process) is used, but you can customize it for your\n                                          specific needs and pass here. Then every other process in the tree\n                                          will be an instance of this custom [Process](#process) implementation\n\nReturns **{proc: [Process](#process), model: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object), block: [Block](#block)}** An object with [Process](#process) instance, model object and block that was passed to\n   the function\n\n### hydrate\n\nThis function replace a `createModel` function in given block\nwith new function that just returns a given model. It is useful\nwhen you have some old model and just want to run everytihing with\nit (for example for server rendering, or hot module replacement)\n\n**Parameters**\n\n-   `block` **[Block](#block)** An original block\n-   `model` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A model object that you want to use\n\n**Examples**\n\n```javascript\n// Hot module replacement example\nimport MyBlock from './MyBlock';\nimport { hydrate, run } from 'mangojuice-core';\n\n// Run initial block\nlet res = run(MyBlock);\n\n// When block changed destroy the old process, hydrate a new\n// block with existing model and run hydrated new block again\nmodule.hot.accept(['./MyBlock'], () => {\n  res.proc.destroy();\n  const newBlock = hydrate(require('./MyBlock'), res.model);\n  res = run(newBlock);\n});\n```\n\nReturns **[Block](#block)** A new block with replaced `createModel` function\n                 which just returns a model that you passed as\n                 second argument.\n\n### delay\n\nA helper function for delaying execution. Returns a Promise\nwhich will be resolved in given amount of milliseconds. You can\nuse it in [task](#task) to implement some delay in execution, for\ndebouncing for example.\n\n**Parameters**\n\n-   `ms` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** An amount of milliseconds to wait\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** A promise that resolved after given amount of milliseconds\n","readmeFilename":"README.md","_id":"mangojuice-core@2.0.0-4","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"artem.artemev","email":"artem@artemevs.com"},"dist":{"integrity":"sha512-Fr0K691d1BL+B9Is6eWIEvz9B6qHqIKFEYg2Y76xRZFOCqapPxRQDvVG+tO0kjI6Lmn8ca1Rj2KI1JIxJ0fBug==","shasum":"b04ab500f1902073278b6d5cf1fcae45d2ff53a0","tarball":"https://registry.npmjs.org/mangojuice-core/-/mangojuice-core-2.0.0-4.tgz","fileCount":34,"unpackedSize":1877987,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDTCoVK2BKIBZTOr28z5F+jLoNCPrWa49ecYbSPA7QzKQIgE87KTmSXPrvLGSnQWTPvrfWXdU8TCkpHLomh5wQIPLM="}]},"maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mangojuice-core_2.0.0-4_1519711600187_0.854185627669465"},"_hasShrinkwrap":false}},"readme":"","maintainers":[{"name":"artem.artemev","email":"artem@artemevs.com"}],"time":{"modified":"2022-06-19T15:45:53.120Z","created":"2017-07-03T18:03:20.489Z","0.1.2-beta.1":"2017-07-03T18:03:20.489Z","0.1.2":"2017-07-08T15:28:45.013Z","0.1.3":"2017-07-12T18:45:24.661Z","0.1.4":"2017-07-14T20:26:52.325Z","0.1.5":"2017-07-14T20:50:28.161Z","0.1.6":"2017-07-16T09:41:53.970Z","0.1.7-beta1":"2017-07-16T10:06:01.676Z","0.1.7-beta2":"2017-07-18T11:44:06.670Z","0.2.0":"2017-08-16T18:41:13.331Z","0.2.1":"2017-10-03T23:33:38.206Z","0.2.2-0":"2017-10-04T00:15:09.580Z","0.2.2-1":"2017-10-04T10:37:39.406Z","0.2.2-2":"2017-10-04T10:51:07.145Z","0.2.2-3":"2017-10-04T11:11:20.159Z","0.2.2-4":"2017-10-06T15:19:42.232Z","0.2.2-5":"2017-10-10T14:02:26.636Z","0.2.2-6":"2017-10-10T15:45:37.773Z","0.2.2-7":"2017-10-10T20:21:07.920Z","0.2.2-8":"2017-10-13T12:15:26.979Z","0.2.2-9":"2017-10-14T22:03:17.889Z","0.2.2-10":"2017-10-15T19:52:28.291Z","0.2.2-11":"2017-10-16T09:37:11.696Z","0.2.2-12":"2017-10-16T13:24:25.333Z","0.2.2-13":"2017-10-17T10:36:17.889Z","0.2.2-14":"2017-10-19T10:34:10.361Z","0.2.2-15":"2017-10-31T20:55:10.844Z","0.2.2-16":"2017-11-05T09:56:19.276Z","0.2.2-17":"2017-11-06T10:25:58.336Z","1.0.0":"2017-11-23T12:30:01.406Z","1.0.1":"2017-11-23T12:54:09.917Z","1.0.2-0":"2017-12-01T08:17:13.887Z","1.0.2-1":"2017-12-01T10:57:58.282Z","1.0.2-2":"2017-12-01T11:40:58.157Z","1.0.2-3":"2017-12-01T12:48:22.828Z","1.0.2-4":"2017-12-05T13:14:14.968Z","1.0.2-y.0":"2017-12-05T20:03:02.760Z","1.0.2-5":"2017-12-05T20:07:52.142Z","1.0.2-6":"2017-12-05T20:50:12.346Z","1.0.2-7":"2017-12-06T17:48:33.908Z","1.0.2-8":"2017-12-06T18:40:03.542Z","1.0.2-9":"2017-12-06T18:46:29.067Z","1.0.2-10":"2017-12-07T08:29:17.991Z","1.0.2-11":"2017-12-07T09:35:52.315Z","1.0.2-12":"2017-12-08T21:46:59.442Z","1.0.2-13":"2017-12-12T12:28:35.581Z","1.0.2-14":"2017-12-13T12:46:37.367Z","1.0.2-15":"2017-12-14T09:12:29.280Z","1.0.2-16":"2017-12-14T09:47:54.026Z","1.0.2-17":"2017-12-15T21:23:46.376Z","1.0.2-18":"2017-12-17T18:36:10.833Z","1.0.2-19":"2017-12-17T18:56:45.864Z","1.1.0":"2017-12-19T21:13:41.258Z","1.2.0":"2017-12-23T09:17:42.259Z","1.2.1":"2017-12-28T08:56:21.319Z","1.2.2":"2017-12-30T19:25:44.447Z","1.2.3":"2018-01-01T15:13:41.313Z","1.2.4":"2018-01-02T19:32:33.894Z","1.2.5":"2018-01-07T08:33:30.865Z","1.2.6":"2018-01-07T08:42:23.537Z","1.2.7":"2018-01-09T09:53:49.351Z","1.2.8":"2018-01-19T11:03:22.133Z","1.2.9":"2018-01-22T12:22:20.496Z","1.2.10":"2018-01-31T16:10:45.467Z","1.2.11":"2018-02-02T17:10:58.653Z","2.0.0-0":"2018-02-24T09:56:16.767Z","2.0.0-y.0":"2018-02-24T14:56:02.865Z","2.0.0-2":"2018-02-24T15:50:14.928Z","2.0.0-3":"2018-02-26T07:52:55.364Z","2.0.0-4":"2018-02-27T06:06:40.322Z"},"homepage":"https://github.com/mangojuicejs/mangojuice#readme","repository":{"type":"git","url":"git+https://github.com/mangojuicejs/mangojuice.git"},"author":{"name":"Artem Artemev","email":"viiv.c58@gmail.com"},"bugs":{"url":"https://github.com/mangojuicejs/mangojuice/issues"},"license":"MIT","readmeFilename":"","description":"## Reference"}