Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Example of IconServiceDecorator

omegascorp edited this page Jan 26, 2016 · 2 revisions

Here is an example of IconServiceDecorator

class IconServiceDecorator {
	constructor() {
		this.delegate = new Material.IconService();
		this.icons = {};
	}
	getIcon(group, name) {
		if(this.icons[group] && this.icons[group][name]) {
			return this.icons[group][name];
		}
		return this.delegate.getIcon(group, name);
	}
}

Material.iconService = new IconServiceDecorator();
Clone this wiki locally