mirror of
https://github.com/usememos/memos.git
synced 2025-11-09 17:01:36 +08:00
chore: fix lint
This commit is contained in:
parent
b596d04939
commit
43a8b7d0e1
1 changed files with 8 additions and 8 deletions
|
|
@ -14,14 +14,14 @@ const createI18nStore = (preloadedState: I18nState) => {
|
||||||
|
|
||||||
const setState = (state: Partial<I18nState>) => {
|
const setState = (state: Partial<I18nState>) => {
|
||||||
const nextState = {
|
const nextState = {
|
||||||
...currentState,
|
...currentState,
|
||||||
...state,
|
...state,
|
||||||
};
|
};
|
||||||
const prevState = currentState;
|
const prevState = currentState;
|
||||||
currentState = nextState;
|
currentState = nextState;
|
||||||
|
|
||||||
for (const cb of listeners) {
|
for (const cb of listeners) {
|
||||||
cb(currentState, prevState);
|
cb(currentState, prevState);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -30,13 +30,13 @@ const createI18nStore = (preloadedState: I18nState) => {
|
||||||
listeners.push(listener);
|
listeners.push(listener);
|
||||||
|
|
||||||
const unsubscribe = () => {
|
const unsubscribe = () => {
|
||||||
if (!isSubscribed) {
|
if (!isSubscribed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = listeners.indexOf(listener);
|
const index = listeners.indexOf(listener);
|
||||||
listeners.splice(index, 1);
|
listeners.splice(index, 1);
|
||||||
isSubscribed = false;
|
isSubscribed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
return unsubscribe;
|
return unsubscribe;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue