Add return types

This commit is contained in:
RMidhunSuresh 2022-07-17 21:07:04 +05:30
parent 9e2d355573
commit 9bdf9c500b

View file

@ -34,7 +34,7 @@ export class ThemeBuilder {
this._platform = platform; this._platform = platform;
} }
async populateDerivedTheme(manifest: ThemeManifest, log: ILogItem) { async populateDerivedTheme(manifest: ThemeManifest, log: ILogItem): Promise<void> {
await log.wrap("ThemeBuilder.populateThemeMap", async (l) => { await log.wrap("ThemeBuilder.populateThemeMap", async (l) => {
const {manifest: baseManifest, location} = this._idToManifest.get(manifest.extends!)!; const {manifest: baseManifest, location} = this._idToManifest.get(manifest.extends!)!;
const {cssLocation, derivedVariables, icons} = this._getSourceData(baseManifest, location, log); const {cssLocation, derivedVariables, icons} = this._getSourceData(baseManifest, location, log);
@ -75,7 +75,8 @@ export class ThemeBuilder {
}); });
} }
private _getSourceData(manifest: ThemeManifest, location: string, log:ILogItem) { private _getSourceData(manifest: ThemeManifest, location: string, log: ILogItem)
: { cssLocation: string, derivedVariables: string[], icons: Record<string, string>} {
return log.wrap("getSourceData", () => { return log.wrap("getSourceData", () => {
const runtimeCSSLocation = manifest.source?.["runtime-asset"]; const runtimeCSSLocation = manifest.source?.["runtime-asset"];
if (!runtimeCSSLocation) { if (!runtimeCSSLocation) {
@ -94,11 +95,11 @@ export class ThemeBuilder {
}); });
} }
get themeMapping() { get themeMapping(): Record<string, ThemeInformation> {
return this._themeMapping; return this._themeMapping;
} }
injectCSSVariables(variables: Record<string, string>) { injectCSSVariables(variables: Record<string, string>): void {
const root = document.documentElement; const root = document.documentElement;
for (const [variable, value] of Object.entries(variables)) { for (const [variable, value] of Object.entries(variables)) {
root.style.setProperty(`--${variable}`, value); root.style.setProperty(`--${variable}`, value);
@ -106,7 +107,7 @@ export class ThemeBuilder {
this._injectedVariables = variables; this._injectedVariables = variables;
} }
removePreviousCSSVariables() { removePreviousCSSVariables(): void {
if (!this._injectedVariables) { if (!this._injectedVariables) {
return; return;
} }