├── .eslintignore ├── .eslintrc.json ├── .github └── FUNDING.yml ├── .gitignore ├── JavaScript ├── README.md ├── applications │ ├── application1 │ │ ├── README.md │ │ └── main.js │ └── application2 │ │ └── main.js ├── framework.js ├── package-lock.json ├── package.json └── wrapper.js ├── LICENSE └── README.md /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es6": true, 5 | "node": true 6 | }, 7 | "extends": "eslint:recommended", 8 | "parserOptions": { 9 | "ecmaVersion": "latest" 10 | }, 11 | "globals": { 12 | "BigInt": true, 13 | "api": true 14 | }, 15 | "rules": { 16 | "indent": [ 17 | "error", 18 | 2 19 | ], 20 | "linebreak-style": [ 21 | "error", 22 | "unix" 23 | ], 24 | "quotes": [ 25 | "error", 26 | "single" 27 | ], 28 | "semi": [ 29 | "error", 30 | "always" 31 | ], 32 | "no-loop-func": [ 33 | "error" 34 | ], 35 | "block-spacing": [ 36 | "error", 37 | "always" 38 | ], 39 | "camelcase": [ 40 | "error" 41 | ], 42 | "eqeqeq": [ 43 | "error", 44 | "always" 45 | ], 46 | "strict": [ 47 | "error", 48 | "global" 49 | ], 50 | "brace-style": [ 51 | "error", 52 | "1tbs", 53 | { 54 | "allowSingleLine": true 55 | } 56 | ], 57 | "comma-style": [ 58 | "error", 59 | "last" 60 | ], 61 | "comma-spacing": [ 62 | "error", 63 | { 64 | "before": false, 65 | "after": true 66 | } 67 | ], 68 | "eol-last": [ 69 | "error" 70 | ], 71 | "func-call-spacing": [ 72 | "error", 73 | "never" 74 | ], 75 | "key-spacing": [ 76 | "error", 77 | { 78 | "beforeColon": false, 79 | "afterColon": true, 80 | "mode": "minimum" 81 | } 82 | ], 83 | "keyword-spacing": [ 84 | "error", 85 | { 86 | "before": true, 87 | "after": true, 88 | "overrides": { 89 | "function": { 90 | "after": false 91 | } 92 | } 93 | } 94 | ], 95 | "max-len": [ 96 | "error", 97 | { 98 | "code": 80, 99 | "ignoreUrls": true 100 | } 101 | ], 102 | "max-nested-callbacks": [ 103 | "error", 104 | { 105 | "max": 7 106 | } 107 | ], 108 | "new-cap": [ 109 | "error", 110 | { 111 | "newIsCap": true, 112 | "capIsNew": false, 113 | "properties": true 114 | } 115 | ], 116 | "new-parens": [ 117 | "error" 118 | ], 119 | "no-lonely-if": [ 120 | "error" 121 | ], 122 | "no-trailing-spaces": [ 123 | "error" 124 | ], 125 | "no-unneeded-ternary": [ 126 | "error" 127 | ], 128 | "no-whitespace-before-property": [ 129 | "error" 130 | ], 131 | "object-curly-spacing": [ 132 | "error", 133 | "always" 134 | ], 135 | "operator-assignment": [ 136 | "error", 137 | "always" 138 | ], 139 | "operator-linebreak": [ 140 | "error", 141 | "after" 142 | ], 143 | "semi-spacing": [ 144 | "error", 145 | { 146 | "before": false, 147 | "after": true 148 | } 149 | ], 150 | "space-before-blocks": [ 151 | "error", 152 | "always" 153 | ], 154 | "space-before-function-paren": [ 155 | "error", 156 | { 157 | "anonymous": "never", 158 | "named": "never", 159 | "asyncArrow": "always" 160 | } 161 | ], 162 | "space-in-parens": [ 163 | "error", 164 | "never" 165 | ], 166 | "space-infix-ops": [ 167 | "error" 168 | ], 169 | "space-unary-ops": [ 170 | "error", 171 | { 172 | "words": true, 173 | "nonwords": false, 174 | "overrides": { 175 | "typeof": false 176 | } 177 | } 178 | ], 179 | "no-unreachable": [ 180 | "error" 181 | ], 182 | "no-global-assign": [ 183 | "error" 184 | ], 185 | "no-self-compare": [ 186 | "error" 187 | ], 188 | "no-unmodified-loop-condition": [ 189 | "error" 190 | ], 191 | "no-constant-condition": [ 192 | "error", 193 | { 194 | "checkLoops": false 195 | } 196 | ], 197 | "no-console": [ 198 | "off" 199 | ], 200 | "no-useless-concat": [ 201 | "error" 202 | ], 203 | "no-useless-escape": [ 204 | "error" 205 | ], 206 | "no-shadow-restricted-names": [ 207 | "error" 208 | ], 209 | "no-use-before-define": [ 210 | "error", 211 | { 212 | "functions": false 213 | } 214 | ], 215 | "arrow-parens": [ 216 | "error", 217 | "always" 218 | ], 219 | "arrow-body-style": [ 220 | "error", 221 | "as-needed" 222 | ], 223 | "arrow-spacing": [ 224 | "error" 225 | ], 226 | "no-confusing-arrow": [ 227 | "error", 228 | { 229 | "allowParens": true 230 | } 231 | ], 232 | "no-useless-computed-key": [ 233 | "error" 234 | ], 235 | "no-useless-rename": [ 236 | "error" 237 | ], 238 | "no-var": [ 239 | "error" 240 | ], 241 | "object-shorthand": [ 242 | "error", 243 | "always" 244 | ], 245 | "prefer-arrow-callback": [ 246 | "error" 247 | ], 248 | "prefer-const": [ 249 | "error" 250 | ], 251 | "prefer-numeric-literals": [ 252 | "error" 253 | ], 254 | "prefer-rest-params": [ 255 | "error" 256 | ], 257 | "prefer-spread": [ 258 | "error" 259 | ], 260 | "rest-spread-spacing": [ 261 | "error", 262 | "never" 263 | ], 264 | "template-curly-spacing": [ 265 | "error", 266 | "never" 267 | ], 268 | "consistent-return": [ 269 | "error", 270 | { "treatUndefinedAsUnspecified": true } 271 | ] 272 | } 273 | } 274 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: tshemsedinov 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /JavaScript/README.md: -------------------------------------------------------------------------------- 1 | ## Dependency Injection 2 | 3 | Purpose: learn how to create sandboxed context for modues to separate them and 4 | minimize cross-modules code coupling, extracting at least two abstraction layers 5 | (applied and system) and how to execute applied code in virtual environment, 6 | changing its behavior using IoC from system layer. 7 | 8 | ## Files 9 | 10 | * `framework.js` - small piece of the framework, just to demonstrate IoC 11 | * `application.js` - small piece of the application, also for IoC demonstration 12 | 13 | ## How to execute 14 | 15 | From the command line, type: `node ./framework.js` or `node framework` 16 | 17 | ## Tasks 18 | 19 | You may select at least one of the following tasks, make a fork of this 20 | repository and implement your solution there. If those tasks are simple 21 | for somebody, please see additional tasks below. 22 | 23 | 1. Add `setTimeout` and `setInterval` to the application context and use them 24 | printing something from the timer function using `console.log()` 25 | 26 | 2. Inject a link to `util` library into the application context and make a few 27 | calls to its functions from applied code 28 | 29 | 3. Implement the ability to run different applications inside framework, using 30 | command line option, e.g.: `node framework ` 31 | 32 | 4. Wrap or intercept `console.log()` call to add more info into console output 33 | in the following format: `