Skip to content

Commit

Permalink
rename update method
Browse files Browse the repository at this point in the history
  • Loading branch information
claviska committed Dec 7, 2021
1 parent b10d1d6 commit 7be1098
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 2.1.3

- Renamed `updateLocalizedTerms()` to `update()` (forgive me SemVer, but nobody was using this I promise)

## 2.1.2

Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface Translation {
}

const connectedElements = new Set<HTMLElement>();
const documentElementObserver = new MutationObserver(updateLocalizedTerms);
const documentElementObserver = new MutationObserver(update);
const translations: Map<string, Translation> = new Map();
let documentLanguage = document.documentElement.lang || navigator.language;
let fallback: Translation;
Expand All @@ -35,7 +35,7 @@ export function registerTranslation(...translation: Translation[]) {
}
});

updateLocalizedTerms();
update();
}

//
Expand Down Expand Up @@ -97,9 +97,9 @@ export function relativeTime(
}

//
// Updates the locale for all localized elements that are currently connected
// Updates all localized elements that are currently connected
//
export function updateLocalizedTerms() {
export function update() {
documentLanguage = document.documentElement.lang || navigator.language;

[...connectedElements.keys()].map((el: LitElement) => {
Expand Down

0 comments on commit 7be1098

Please sign in to comment.