Experiment: Using Service Barrels As A De Facto Dependency-Injection Container In Vue.js 2.5.22
BRANK

Coming from an Angular.js / Angular background, one of the first things I that noticed in Vue.js is that Dependency-Injection (DI) is not a first-class citizen of the framework. There is some DI in Vue.js; but, it only pertains to the component tree - not to the services that drive the application logic. Having used Dependency-Injection for years in Angular, this left wondering as to how Vue.js developers even locate their services? There doesn't seem to be much discussion on this matter - at least, not that I could find on the Googles. So, as an experiment, I wanted to see if I could use the native caching of JavaScript modules to create a de factor Dependency-Injection container where I could manually apply some Inversion of Control (IoC) patterns to my application service classes in Vue.js 2.5.22.Run this demo in my JavaScript Demos project on GitHub.View this code in my JavaScript Demos project on GitHub.In the past, I've often asked React.js developers how they locate their appli…

bennadel.com
Related Topics: Vue.js JavaScript HTTP