MCPcopy
hub / github.com/ionic-team/ionicons / loadIcon

Method loadIcon

src/components/icon/icon.tsx:173–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

171 @Watch('ios')
172 @Watch('md')
173 loadIcon() {
174 if (Build.isBrowser && this.isVisible) {
175 const url = getUrl(this);
176
177 if (url) {
178 if (ioniconContent.has(url)) {
179 // sync if it's already loaded
180 this.svgContent = ioniconContent.get(url);
181 } else {
182 // async if it hasn't been loaded
183 getSvgContent(url, this.sanitize).then(() => (this.svgContent = ioniconContent.get(url)));
184 }
185 this.didLoadIcon = true;
186 }
187 }
188
189 this.iconName = getName(this.name, this.icon, this.mode, this.ios, this.md);
190 }
191
192 render() {
193 const { flipRtl, iconName, inheritedAttributes, el } = this;

Callers 2

connectedCallbackMethod · 0.95
componentDidLoadMethod · 0.95

Calls 3

getUrlFunction · 0.90
getSvgContentFunction · 0.90
getNameFunction · 0.90

Tested by

no test coverage detected