TS FACADE PATTER
/*Proxy
The Proxy design pattern is a design pattern lets you provide a surrogate
or placeholder object for another object to control access to it.
For example imagine you want to give students access to a
library but you don't want them to be able to access the library directly.
First you need to make a library class:
*/
class Library {
public getBooks() {
console.log('Getting books...');
}
}
// Then you make a proxy class that will give students access to the library:
class LibraryProxy {
constructor(private library: Library) {}
public getBooks() {
this.library.getBooks();
}
}
// Then you make your library:
const library = new LibraryProxy(new Library());
library.getBooks();
Puzzled Puffin