promises
This commit is contained in:
parent
88b2f89877
commit
11054bdad7
7 changed files with 17 additions and 21 deletions
|
|
@ -122,7 +122,7 @@ const EmojiTab = {
|
||||||
return this.refreshPackList()
|
return this.refreshPackList()
|
||||||
} else {
|
} else {
|
||||||
this.displayError(resp.error)
|
this.displayError(resp.error)
|
||||||
return Promise.reject(resp)
|
throw new Error(resp)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
@ -139,7 +139,7 @@ const EmojiTab = {
|
||||||
return this.refreshPackList()
|
return this.refreshPackList()
|
||||||
} else {
|
} else {
|
||||||
this.displayError(resp.error)
|
this.displayError(resp.error)
|
||||||
return Promise.reject(resp)
|
throw new Error(resp)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
@ -239,7 +239,7 @@ const EmojiTab = {
|
||||||
return this.refreshPackList()
|
return this.refreshPackList()
|
||||||
} else {
|
} else {
|
||||||
this.displayError(resp.error)
|
this.displayError(resp.error)
|
||||||
return Promise.reject(resp)
|
throw new Error(resp)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
@ -259,7 +259,7 @@ const EmojiTab = {
|
||||||
return this.refreshPackList()
|
return this.refreshPackList()
|
||||||
} else {
|
} else {
|
||||||
this.displayError(resp.error)
|
this.displayError(resp.error)
|
||||||
return Promise.reject(resp)
|
throw new Error(resp)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
@ -280,7 +280,7 @@ const EmojiTab = {
|
||||||
return this.refreshPackList()
|
return this.refreshPackList()
|
||||||
} else {
|
} else {
|
||||||
this.displayError(resp.error)
|
this.displayError(resp.error)
|
||||||
return Promise.reject(resp)
|
throw new Error(resp)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ export default {
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
if (resp.error !== undefined) {
|
if (resp.error !== undefined) {
|
||||||
this.$emit('displayError', resp.error)
|
this.$emit('displayError', resp.error)
|
||||||
return Promise.reject(resp.error)
|
throw new Error(resp.error)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.json()
|
return resp.json()
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ export const piniaPersistPlugin =
|
||||||
const setState = (state) => {
|
const setState = (state) => {
|
||||||
if (!loadedGuard.loaded) {
|
if (!loadedGuard.loaded) {
|
||||||
console.info('waiting for old state to be loaded...')
|
console.info('waiting for old state to be loaded...')
|
||||||
return Promise.reject()
|
throw new Error('Waiting')
|
||||||
} else {
|
} else {
|
||||||
return storage.setItem(key, state)
|
return storage.setItem(key, state)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -359,11 +359,7 @@ export const getResourcesIndex = async (url, parser = (x) => x) => {
|
||||||
|
|
||||||
const total = [...custom, ...builtin]
|
const total = [...custom, ...builtin]
|
||||||
if (total.length === 0) {
|
if (total.length === 0) {
|
||||||
return Promise.reject(
|
throw new Error(`Resource at ${url} and ${customUrl} completely unavailable. Panicking`)
|
||||||
new Error(
|
|
||||||
`Resource at ${url} and ${customUrl} completely unavailable. Panicking`,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return Promise.resolve(Object.fromEntries(total))
|
return Promise.resolve(Object.fromEntries(total))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,9 @@ function getOrCreateServiceWorker() {
|
||||||
|
|
||||||
function subscribePush(registration, isEnabled, vapidPublicKey) {
|
function subscribePush(registration, isEnabled, vapidPublicKey) {
|
||||||
if (!isEnabled)
|
if (!isEnabled)
|
||||||
return Promise.reject(new Error('Web Push is disabled in config'))
|
throw new Error('Web Push is disabled in config')
|
||||||
if (!vapidPublicKey)
|
if (!vapidPublicKey)
|
||||||
return Promise.reject(new Error('VAPID public key is not found'))
|
throw new Error('VAPID public key is not found')
|
||||||
|
|
||||||
const subscribeOptions = {
|
const subscribeOptions = {
|
||||||
userVisibleOnly: false,
|
userVisibleOnly: false,
|
||||||
|
|
|
||||||
|
|
@ -512,7 +512,7 @@ export const convertTheme2To3 = (data) => {
|
||||||
{ ...newRule, component: 'Tab' },
|
{ ...newRule, component: 'Tab' },
|
||||||
{ ...newRule, component: 'ScrollbarElement' },
|
{ ...newRule, component: 'ScrollbarElement' },
|
||||||
]
|
]
|
||||||
if (newRule.state?.indexOf('toggled') >= 0) {
|
if (newRule.state?.includes('toggled')) {
|
||||||
rules.push({ ...newRule, state: [...newRule.state, 'focused'] })
|
rules.push({ ...newRule, state: [...newRule.state, 'focused'] })
|
||||||
rules.push({ ...newRule, state: [...newRule.state, 'hover'] })
|
rules.push({ ...newRule, state: [...newRule.state, 'hover'] })
|
||||||
rules.push({
|
rules.push({
|
||||||
|
|
@ -520,7 +520,7 @@ export const convertTheme2To3 = (data) => {
|
||||||
state: [...newRule.state, 'hover', 'focused'],
|
state: [...newRule.state, 'hover', 'focused'],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (newRule.state?.indexOf('hover') >= 0) {
|
if (newRule.state?.includes('hover')) {
|
||||||
rules.push({ ...newRule, state: [...newRule.state, 'focused'] })
|
rules.push({ ...newRule, state: [...newRule.state, 'focused'] })
|
||||||
}
|
}
|
||||||
return rules
|
return rules
|
||||||
|
|
|
||||||
|
|
@ -690,11 +690,11 @@ export const init = ({
|
||||||
.map((combination) => ['normal', ...combination])
|
.map((combination) => ['normal', ...combination])
|
||||||
.filter((combo) => {
|
.filter((combo) => {
|
||||||
// Optimization: filter out some hard-coded combinations that don't make sense
|
// Optimization: filter out some hard-coded combinations that don't make sense
|
||||||
if (combo.indexOf('disabled') >= 0) {
|
if (combo.includes('disabled')) {
|
||||||
return !(
|
return !(
|
||||||
combo.indexOf('hover') >= 0 ||
|
combo.includes('hover') ||
|
||||||
combo.indexOf('focused') >= 0 ||
|
combo.includes('focused') ||
|
||||||
combo.indexOf('pressed') >= 0
|
combo.includes('pressed')
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
@ -711,7 +711,7 @@ export const init = ({
|
||||||
combination.component = component.name
|
combination.component = component.name
|
||||||
combination.lazy = component.lazy || parent?.lazy
|
combination.lazy = component.lazy || parent?.lazy
|
||||||
combination.parent = parent
|
combination.parent = parent
|
||||||
if (!liteMode && combination.state.indexOf('hover') >= 0) {
|
if (!liteMode && combination.state.includes('hover')) {
|
||||||
combination.lazy = true
|
combination.lazy = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue