Skip to content

Instantly share code, notes, and snippets.

@jotak
Created December 10, 2014 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jotak/527a10b9ca8b123200dc to your computer and use it in GitHub Desktop.
Save jotak/527a10b9ca8b123200dc to your computer and use it in GitHub Desktop.
// Layer interface
interface Layer {
search: (str: string)=>void;
}
// File Controller.js
function search(str) {
var layers: Layer[] = getAllActiveLayers();
layers.forEach(function(layer) {
layer.search(str);
});
}
// File MpdLayer.js
class MpdLayer implements Layer {
public search(str: string) {
// run search str
}
}
// File SpopLayer.js
class SpopLayer implements Layer {
public search(str: string) {
// run search str
}
}
// File GoogleLayer.js
class GoogleLayer implements Layer {
public search(str: string) {
// run search str
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment