Skip to content

Commit

Permalink
feat(): add existStyle method
Browse files Browse the repository at this point in the history
  • Loading branch information
Enlcxx committed Jun 22, 2019
1 parent fcc15c7 commit 5567baf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib/src/theme/theme2.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ export class LyTheme2 {
return this._createStyleContent2(styles, null, priority, TypeStyle.Multiple);
}

/**
* Check if a style exist
* @param stylesOrId Style or Id of a style
*/
existStyle(stylesOrId: string | Styles | StyleDeclarationsBlock): boolean {
if (_STYLE_MAP.has(stylesOrId)) {
const styleMap = _STYLE_MAP.get(stylesOrId)!;
return !!(styleMap.classes || styleMap[this.initialTheme]);
}
return false;
}

private _createStyleContent2(
styles: Styles | StyleDeclarationsBlock,
id: string | null,
Expand Down

0 comments on commit 5567baf

Please sign in to comment.