lavva.exalushome
Version:
Library implementing communication and abstraction layers for ExalusHome system
21 lines • 849 B
JavaScript
export class AppLocalesService {
GetCurrentLocalesAsync() {
if (!this.IsAvailable())
return Promise.resolve(undefined);
return navigator.AppLocales.GetCurrentLocalesAsync();
}
SetCurrentLocalesAsync(locale) {
if (!this.IsAvailable())
throw new Error("AppLocalesService is not available");
return navigator.AppLocales.SetCurrentLocalesAsync(locale);
}
IsAvailable() {
var _a, _b;
return navigator.AppLocales !== undefined || ((_b = (_a = window.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.appLocales) !== undefined;
}
GetServiceName() {
return AppLocalesService.ServiceName;
}
}
AppLocalesService.ServiceName = "AppLocalesService";
//# sourceMappingURL=AppLocalesService.js.map