While writing the upcoming Part 2 of my Pluralsight course Building Apps with Angular and Breeze, I found myself wanting to extend a constructor object with another constructor’s members. I had an object called AbstractRepository that has a set of functions (ex: getAll, queryFailed) that could be shared by many repositories. I had a LookupRepository with its own functions that are very specific to getting “lookups”. The way I settled on was to extend the AbstractRepository’s functions onto the LookupRepository by setting the prototype’s constructor. The result is that the LookupRepository gets all the functions that it has plus the AbstractRepository’s functions too. This technique is something Ward Bell and...
- $100 off Pluralsight Subscription
- Is Your VS Code Extension Slow? Here's How to Speed it Up!
- 3 Things You Can Do to Improve as a Developer
- Peacock - Late Night Coding FTW
- Keep Calm, and Keep Coding with Cosmos and Node.js
- Vue CLI - Developing Faster!
- Everything You Need for Coding with Node and Cosmos DB in 60 Seconds-ish