diff --git a/README.md b/README.md index 4fffd81..cc93157 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Jetli allows you to inject consistently classes, functions and primitives across Injecting instances of classes is trivial with jetli - just use 'get' method without any additional options. -
const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; class Attack { constructor(){ @@ -78,7 +78,7 @@ Functions, already instantiated objects or primitive values like array, string a Registration is provided via 'set' method and requires you to provide string token that identifies the injectable element. -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; class Attack { constructor(){ @@ -101,7 +101,7 @@ fighter2.punch();As explained in previous example primitives can be easily used across your applications with associated string id provided during registration. -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; const someNumber = 123; const someString = 'punch'; @@ -126,7 +126,7 @@ To use Jetli to full extend implement services that expose init method. This met If you already initialised injectable and dont want jetli to call "init" make sure to set "initialise" property to true; -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; jetli.set('someNumber', 123); @@ -157,7 +157,7 @@ fighter2.punch();Have enough of overhead when all those services initialises at once? Register them and request initialisation only when injection is requested. -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; class Attack { constructor(){ @@ -180,7 +180,7 @@ fighter2.punch();### Pass arguments to services constructor -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; class Attack { constructor(id){ @@ -204,7 +204,7 @@ fighter2.punch();Jetli uses battle-tested method to fight 'cyclic dependencies' - optional initialisation callback. Injector searches for optional "init" method to call it and as an argument to provide instance of injector itself. This method provide safe moment to inject all dependencies required by service - you can be sure that all dependencies will be already initialised. -const jetli = require('jetli@2.0.0').jetli; +### Mock services for test purposes Its rather trivial to mock module dependencies if you have total control whats injected where, right? ith Jetli you can reset any previously registered/injected dependencies and introduce your own mocks / stubs. -const jetli = require('jetli@2.0.1').jetli; class ServiceA { constructor(){ @@ -247,14 +247,14 @@ class ServiceB { const serviceA = jetli.get(ServiceA); const serviceB = jetli.get(ServiceB); -serviceA.getId(); -serviceB.getId();+console.log(serviceA.getId()); +console.log(serviceB.getId());const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; class Attack { constructor(){ @@ -271,7 +271,6 @@ class AttackMock { console.log(`Attack mocked!`); } punch(){ - super.punch(); console.log(`Mocked attack execution!`); } } diff --git a/package.json b/package.json index db5af86..3cc4c8a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jetli", - "version": "2.0.0", + "version": "2.0.1", "description": "Simple, lightweight dependency injector - supports factories, classes and primitives.", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", diff --git a/src/docs/api-docs.script.html b/src/docs/api-docs.script.html index 7d5a28a..95643af 100644 --- a/src/docs/api-docs.script.html +++ b/src/docs/api-docs.script.html @@ -3,6 +3,16 @@ initArchivalDocsList(); initRunkit(); + initGithubRibbon(); + + function initGithubRibbon() { + const ribbonContent = ''; + const node = document.createElement('a'); + node.setAttribute('href', 'https://github.com/thefill/jetli'); + node.className = 'github-corner'; + node.innerHTML = ribbonContent; + document.body.prepend(node); + } // Convert code examples to the Runkit containers function initRunkit() { diff --git a/src/docs/api-docs.style.html b/src/docs/api-docs.style.html index 69786a8..3231b56 100644 --- a/src/docs/api-docs.style.html +++ b/src/docs/api-docs.style.html @@ -49,4 +49,43 @@ } } + .github-corner svg { + fill:#64CEAA; + color:#fff; + position: absolute; + top: 40px; + border: 0; + right: 0; + } + + .tsd-panel.tsd-typography { + border-radius: 0 30px 0 0; + } + + .github-corner:hover .octo-arm { + animation: octocat-wave 560ms ease-in-out + } + + @keyframes octocat-wave { + 0%, 100% { + transform: rotate(0) + } + 20%, 60% { + transform: rotate(-25deg) + } + 40%, 80% { + transform: rotate(10deg) + } + } + + @media (max-width: 500px) { + .github-corner:hover .octo-arm { + animation: none + } + + .github-corner .octo-arm { + animation: octocat-wave 560ms ease-in-out + } + } + diff --git a/src/docs/readme.body.md b/src/docs/readme.body.md index a406a10..41630ed 100644 --- a/src/docs/readme.body.md +++ b/src/docs/readme.body.md @@ -36,7 +36,7 @@ Jetli allows you to inject consistently classes, functions and primitives across Injecting instances of classes is trivial with jetli - just use 'get' method without any additional options. -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; class Attack { constructor(){ @@ -60,7 +60,7 @@ Functions, already instantiated objects or primitive values like array, string a Registration is provided via 'set' method and requires you to provide string token that identifies the injectable element. -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; class Attack { constructor(){ @@ -83,7 +83,7 @@ fighter2.punch();As explained in previous example primitives can be easily used across your applications with associated string id provided during registration. -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; const someNumber = 123; const someString = 'punch'; @@ -108,7 +108,7 @@ To use Jetli to full extend implement services that expose init method. This met If you already initialised injectable and dont want jetli to call "init" make sure to set "initialise" property to true; -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; jetli.set('someNumber', 123); @@ -139,7 +139,7 @@ fighter2.punch();Have enough of overhead when all those services initialises at once? Register them and request initialisation only when injection is requested. -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; class Attack { constructor(){ @@ -162,7 +162,7 @@ fighter2.punch();### Pass arguments to services constructor -const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; class Attack { constructor(id){ @@ -186,7 +186,7 @@ fighter2.punch();Jetli uses battle-tested method to fight 'cyclic dependencies' - optional initialisation callback. Injector searches for optional "init" method to call it and as an argument to provide instance of injector itself. This method provide safe moment to inject all dependencies required by service - you can be sure that all dependencies will be already initialised. -const jetli = require('jetli@2.0.0').jetli; +### Mock services for test purposes Its rather trivial to mock module dependencies if you have total control whats injected where, right? ith Jetli you can reset any previously registered/injected dependencies and introduce your own mocks / stubs. -const jetli = require('jetli@2.0.1').jetli; class ServiceA { constructor(){ @@ -229,14 +229,14 @@ class ServiceB { const serviceA = jetli.get(ServiceA); const serviceB = jetli.get(ServiceB); -serviceA.getId(); -serviceB.getId();+console.log(serviceA.getId()); +console.log(serviceB.getId());const jetli = require('jetli@2.0.0').jetli; +const jetli = require('jetli@2.0.1').jetli; class Attack { constructor(){ @@ -253,7 +253,6 @@ class AttackMock { console.log(`Attack mocked!`); } punch(){ - super.punch(); console.log(`Mocked attack execution!`); } }