mirror of
https://github.com/jason5ng32/MyIP.git
synced 2026-11-04 08:55:47 +00:00
Events keep saying "this happened"; commands say "do this" — single owner, dispatch resolves when the work finishes with the owner's result, reject codes unavailable/timeout (bus) and auth/quota/input (owners, via appCommandError). Homepage sections register ipinfo:refresh / connectivity:run / webrtc:run / dnsleak:run / speedtest:toggle; keyboard shortcuts, the refresh orchestrator, and Persona Check's dependency repair dispatch instead of reaching through template refs, and Home.vue sheds the test-section refs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
14 lines
589 B
JavaScript
14 lines
589 B
JavaScript
// Vue binding for the command bus (utils/app-commands.js): register a command
|
|
// owner for the life of the current component / effect scope. Registration
|
|
// happens at setup time so the command is dispatchable as soon as the owner
|
|
// exists; the scope's disposal unregisters it.
|
|
|
|
import { getCurrentScope, onScopeDispose } from 'vue';
|
|
import { registerAppCommand } from '../utils/app-commands.js';
|
|
|
|
export const useAppCommand = (name, handler) => {
|
|
const unregister = registerAppCommand(name, handler);
|
|
if (getCurrentScope()) onScopeDispose(unregister);
|
|
return unregister;
|
|
};
|