Execute Command From Your App

Commands in the @beacon.li/bar package allow you to trigger specific actions or operations within your app, providing a way to interact with your application's functionality programmatically.

Executing a Command

To execute a command from your app, you can use the Beacon.executeCommand method. This method takes one parameter:

  • commandId (string): The unique identifier of the command you want to execute.

Here's how to use it:

import { Beacon } from '@beacon.li/bar';
Beacon.executeCommand('commandId');

In the example above, we are executing a command with the ID 'commandId'. This will trigger the specific action associated with that command within your app.

Use Cases

Commands can be used for a variety of purposes, such as:

  • Automating tasks or actions within your app.

  • Responding to user interactions with the Beacon widget.

  • Integrating with external services or APIs based on user requests.

By incorporating commands into your app using @beacon.li/bar, you can provide users with a seamless and interactive experience, allowing them to perform actions or operations with ease.

Important Consideration

When defining commands and their associated actions in your app, ensure that you have a clear understanding of what each command does and that it aligns with your app's functionality and user experience.

By following these steps, you can execute commands programmatically within your app using the Beacon.executeCommand method from @beacon.li/bar.

Last updated