Overview
TheSubscriptionManager component is the root container component that allows users to add and manage multiple object subscriptions. It provides an input field to add new objects by name and displays each object subscription in its own ObjectSubscription component.
This component uses local storage to persist the list of subscribed objects across sessions.
Source: src/components/SubscriptionManager.vue
Props
The LiveUpdate instance returned from the
useLiveUpdate composable. This is passed down to child ObjectSubscription components to enable property subscriptions.Features
Persistent Storage
The component usesuseStorage from VueUse to persist subscribed objects in local storage with the key disguise-liveupdate-tester-subscriptionmanager. This ensures that object subscriptions are maintained across page reloads.
Duplicate Prevention
When adding a new object, the component checks if it already exists in the subscription list and alerts the user if attempting to add a duplicate:Default Object Name
The input field is pre-populated with a default object namescreen2:surface_1 to help users get started quickly.
Usage
Component Structure
The component renders:- An input field for entering object names
- An “Add” button to add new subscriptions
- A list of
ObjectSubscriptioncomponents, one for each subscribed object
Methods
addObject()
Adds a new object to the subscription list. Triggered by clicking the “Add” button or pressing Enter in the input field. Prevents duplicate objects from being added.removeObject(objectName: string)
Removes an object from the subscription list. Called when theremove event is emitted from an ObjectSubscription component.
Location: src/components/SubscriptionManager.vue:44