const finder = new FinderClass();
const gallery1 = new GalleryClass(finder);
const gallery2 = new GalleryClass(finder);
There is a "search" method on finder
: finder.search(query)
. When I call "search" how do I know whether the caller is gallery1
or gallery2
?
var GalleryClass = function(finder) {
this._finder = finder;
}
GalleryClass.prototype = {
doSearch(query) {
return this._finder.search(query);
}
}