O'Reilly logo

Mastering TypeScript by Nathan Rozentals

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a Service Locator

The idea of the Service Location Pattern is that some areas of an application can be broken down into services. Each service should adhere to our SOLID design principles, and provide a small external interface that acts as a service API. Each service used by an application is then registered with a service locator. When a specific piece of information or functionality is required by the application, it can query this service locator to find the correct service, based on the service interface.

The problem space

In the previous chapter, we explored Backbone, where our application was broken down into models, collections, and views. Outside of these elements, we also had an application class to coordinate the loading of data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required