Message from JavaScript discussions

November 2020

— Not only do you avoid recursive dependencies, but you also open up to a lot of other flexibility goodies.. Like testing (mockability), you can wrap dependencies to your liking to add more functionality (e.g. a logger attached to fs.writeFile calls) there are many possibilities. It might look like a bit too much code, but you will soon appreciate the flexibility.

Message permanent page

— 

It works like that:

// index.js
const dependencies = {
a: require('./a'),
b: require('./b'),
}

// a.js
module.exports = dependencies => ({
getFile: () => 'filename',
save: () => {
dependencies.b(dependencies).whatever()
}

})

// b.js
module.exports = dependencies => ({
whatever: () => dependencies
.a(dependencies).getFile()
})

— This is better viewed here: https://runkit.com/martinmuzatko/5fb27e910c4e54001abe8221

— Thanks for the help. I will try implementing it and see how it goes

— Don't hesitate to ask, if you have any questions :)

— This is so wonky

— We need website developer or freelancer.
Send msg,
Gmail:simkattech123gmail.com
9886050751

— Senior html developer?

— I can nest interactive elements even without a shame ❤️

— "If I am grown up, I want to be a Senior HTML developer" lel! :D

— Xd

— Lmao