Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
feat: expose actively bound actions via activeActions$
Andrew Bastindad18aabcb86
diff --git a/helpers/actions.ts b/helpers/actions.tsindex bf68ffacb..68ae2721b 100644--- a/helpers/actions.ts+++ b/helpers/actions.ts@@ -3,6 +3,7 @@*/import { onBeforeUnmount, onMounted } from "@nuxtjs/composition-api"+import { BehaviorSubject } from "rxjs"export type HoppAction =| "request.send-cancel" // Send/Cancel a Hoppscotch Request@@ -35,12 +36,16 @@ type BoundActionList = {const boundActions: BoundActionList = {}+export const activeActions$ = new BehaviorSubject<HoppAction[]>([])+export function bindAction(action: HoppAction, handler: () => void) {if (boundActions[action]) {boundActions[action]?.push(handler)} else {boundActions[action] = [handler]}++ activeActions$.next(Object.keys(boundActions) as HoppAction[])}export function invokeAction(action: HoppAction) {@@ -49,6 +54,12 @@ export function invokeAction(action: HoppAction) {export function unbindAction(action: HoppAction, handler: () => void) {boundActions[action] = boundActions[action]?.filter((x) => x !== handler)++ if (boundActions[action]?.length === 0) {+ delete boundActions[action]+ }++ activeActions$.next(Object.keys(boundActions) as HoppAction[])}export function defineActionHandler(action: HoppAction, handler: () => void) {