-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(assets): options storage (#379)
- Loading branch information
1 parent
8d34de1
commit 75512f8
Showing
4 changed files
with
21 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
import { toRefs, watchDebounced } from '@vueuse/core' | ||
|
||
// Assets | ||
const assetsOptions = ref(await rpc.getOptions('assets')) | ||
const assets = toRefs(assetsOptions) | ||
|
||
watchDebounced(assetsOptions, async (options) => { | ||
rpc.updateOptions('assets', options) | ||
}, { deep: true, flush: 'post', debounce: 500, maxWait: 1000 }) | ||
|
||
// Server Routes | ||
const serverRouteOptions = ref(await rpc.getOptions('serverRoutes')) | ||
const serverRoutes = toRefs(serverRouteOptions) | ||
|
||
watchDebounced(serverRouteOptions, async (options) => { | ||
rpc.updateOptions('serverRoutes', options) | ||
}, { deep: true, flush: 'post', debounce: 500, maxWait: 1000 }) | ||
|
||
// Options List | ||
const list = { | ||
serverRoutes, | ||
assets, | ||
} | ||
|
||
export function useDevToolsOptions<T extends keyof typeof list>(tab: T) { | ||
return list[tab] | ||
} | ||
|
||
// Server Routes | ||
watchDebounced(serverRouteOptions, async (options) => { | ||
rpc.updateOptions('serverRoutes', options) | ||
}, { deep: true, flush: 'post', debounce: 500, maxWait: 1000 }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,7 @@ export const defaultTabOptions: NuxtDevToolsOptions = { | |
headers: [], | ||
}, | ||
}, | ||
assets: { | ||
view: 'grid', | ||
}, | ||
} |