fuse.js is a versatile JavaScript library designed for seamless integration and communication across the eTag Fuse ecosystem and integrated applications. It provides powerful methods, events, and properties that enable developers to manage windows, automate tasks, interact with the UI, and integrate messaging, notifications and access many of the Fuse capabilities effectively.
fuse.js aims to simplify complex interactions within web applications by offering:
The Fuse.js library is a fundamental part of the eTag Fuse ecosystem, designed to facilitate UI-level integration and seamless interoperability between applications hosted in the Fuse Hub. It serves as the glue that connects diverse applications, enabling them to interact securely, efficiently, and dynamically.
The fuse.js library bridges applications and workflows within the Fuse Hub, providing:
By leveraging Fuse.js, developers can integrate their applications into the Fuse UI Integration framework, where:
fuse.js is the backbone of the Fuse UI Integration framework, which transforms the Fuse Hub into a Single Pane of Glass (SPOG). It provides the tools and infrastructure for applications to:
At its core, Fuse.js is built on an event-driven architecture where:
Locate the fuse.js Library
The fuse.js library is included in the Fuse Hub’s JavaScript directory. The URL typically follows this format:
https://<your-fusehub-domain>/js/fuse.js
Example:
https://www.fusehub.com/js/fuse.js
Add the Library to Your Application Page
Include a reference to the fuse.js library in your HTML file. Below is an example of how to integrate the library into your application:
<html lang="en">
<head>
<title>Example: Fuse Integration</title>
<script type="text/javascript" src="https://www.fusehub.com/js/fuse.js"></script>
</head>
<body>
<h1>Welcome to the Fuse Integrated Application</h1>
</body>
</html>
By following these steps, your application is now ready to utilize the features and capabilities of the Fuse.js library. Let me know if you'd like additional details or examples!
The $fuse object serves as the central interface for interacting with the Fuse.js library. It provides access to the library's core functionality, including methods, events, and properties for managing windows, navigating pages, handling UI interactions, automating processes, and more.
Core Interface
The $fuse
object provides access to all primary methods and utilities of the Fuse.js library. These methods are grouped into functional categories, such as window/page management, navigation, notifications, and more.
Event Handling
$fuse
includes methods to bind, unbind, and manage events. This enables developers to hook into key application lifecycle events like window activation, navigation, and message broadcasting.
Dynamic Interaction
$fuse
enables seamless interaction with UI components, windows, themes, and resources. Developers can create dynamic, interactive experiences using its rich feature set.
Automation
$fuse
supports the execution of automation workflows and tasks via methods like execRPC
, making it a powerful tool for advanced use cases.
Extensibility
$fuse
supports integration with custom UI components, navigation items, and more, making it a flexible tool for extending application functionality.
Basic Usage
$fuse.activate();
$fuse.openPage({
url: '/dashboard',
title: 'Dashboard',
});
$fuse.sendNotification({
message: 'Welcome to Fuse.js!',
type: 'info',
});
Event Handling
$fuse.addEvent('OnActivate', (e) => {
console.log('Window activated:', e);
});
$fuse.removeEvent('OnActivate');
The $fuse
object is globally available when the Fuse.js library is loaded into the application. Its methods, properties, and events are accessible to all scripts within the application context.
Method chaining allows developers to invoke multiple $fuse
methods in a single statement. Each method in the chain operates sequentially, simplifying code structure and enhancing readability.
Example: Method Chaining
Instead of calling each method separately:
$fuse.addEvent('OnMessage', onMessageHandler);
$fuse.addEvent('OnError', onErrorHandler);
$fuse.callout('Welcome to eTag Fuse!');
You can use method chaining:
$fuse
.addEvent('OnMessage', onMessageHandler)
.addEvent('OnError', onErrorHandler)
.callout('Welcome to eTag Fuse!');
Benefits of Method Chaining
This section provides includes members for managing and interacting with the current window, other windows or pages within the Fuse hub. These members allow developers to access informaiton, control behaviors, modify properties, and enhance user interactions programmatically.
These members empower developers to create dynamic, responsive applications that enhance user productivity and deliver a seamless experience across the Fuse ecosystem.
The activate method is used to activate the window, ensuring it is in focus. It triggers a series of events before and after the window is activated, allowing developers to hook into these events for custom behaviors.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
handler | function | Yes | A callback function invoked after the operation is completed. |
userContext | object | Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
Example Usage
$fuse.activate();
The button method retrieves a button by its name or identifier, returning an instance of the button object for further interaction or manipulation.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
key |
string |
Yes | The name or identifier of the button to retrieve. |
Returns
Returns a eTag.Fuse.Button
object.
eTag.Fuse.Button Object
Property | Type | Default | Description |
---|---|---|---|
id |
string |
The unique identifier for the button. | |
text |
string |
The display text for the button. | |
context |
string |
footer |
The button's context. Can be header (displayed on the header) or footer . |
enabled |
boolean |
true |
Indicates whether the button is enabled. |
display |
boolean |
true |
Indicates whether the button is visible. |
width |
string |
The width of the button. | |
index |
string |
The position index of the button. | |
displayExpression |
string |
An expression to determine the button's visibility. | |
enableExpression |
string |
An expression to determine the button's enabled state. | |
commandExpression |
string |
An expression to execute when the button is pressed. |
Example Usage
// Retrieve a button by its identifier
const submitButton = $fuse.button('submitBtn');
console.log('Button Text:', submitButton.text);
The close method is used to close a window. It allows additional information to be passed to the target Fuse window when closing.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
arguments |
object |
Yes | Additional information to pass to the target Fuse window. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
// Close the current window
$fuse.close();
// Close a window with additional arguments
$fuse.close({
reason: 'User logged out',
saveState: true,
});
The contentHeight method retrieves the total height of the document within the current window.
Parameters
This method does not accept any parameters.
Returns
Type | Description |
---|---|
number |
The total height of the document. |
Example Usage
const height = $fuse.contentHeight();
console.log('Document Height:', height);
The contentHeight
method is particularly useful for scenarios where you need to dynamically adjust or respond to the content's height within a window or iframe.
The contentWidth method retrieves the total width of the document within the current window.
Parameters
This method does not accept any parameters.
Returns
Type | Description |
---|---|
number |
The total width of the document. |
Example Usage
const width = $fuse.contentWidth();
console.log('Document Width:', width);
The contentWidth
method is particularly useful for scenarios where you need to dynamically adjust or respond to the content's width within a window or iframe.
The findWindow method retrieves one or more opened windows that match the specified criteria.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
arguments |
eTag.Fuse.FindWindowArgs |
Yes | The arguments containing search criteria and attributes to return. |
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
eTag.Fuse.FindWindowArgs Object
Property | Type | Optional | Description |
---|---|---|---|
criteria |
object |
Yes | Key-value pairs used to retrieve windows. Example: { contentUrl: 'page.html$' } . |
attrbs |
string[] |
Yes | Additional window attributes to return. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
Example Usage
const searchCriteria = {
criteria: { contentUrl: 'dashboard.html$' },
attrbs: ['id', 'title']
};
$fuse.findWindow(searchCriteria, function(result) {
console.log('Matching Windows:', result);
});
The findWindow
method is ideal for scenarios where you need to locate specific windows based on their properties, such as URL or attributes.
The hide method hides the current window. It triggers events before and after the window is hidden, enabling developers to hook into these events for custom behaviors.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnHide
: This event is triggered after the window is hidden.Events
OnHide
: Raised after the window is successfully hidden.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: Hide . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
// Add Hide event listener
function onHide(e) {
console.log('Window hidden:', e);
}
$fuse.addEvent('OnHide', onHide);
// Remove Hide event listener
$fuse.removeEvent('OnHide', onHide);
// Clear all Hide event listeners
$fuse.clearEvent('OnHide');
Example Usage
$fuse.hide(function() {
console.log('Window has been hidden.');
}, { contextKey: 'exampleContext' });
The hide
method is useful for dynamically hiding windows while providing flexibility through event handling and callbacks.
The maximize method maximizes the current window. It triggers events before and after the window is maximized, allowing developers to respond to these events for custom behaviors.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
Example Usage
$fuse.maximize(function() {
console.log('Window has been maximized.');
}, { contextKey: 'exampleContext' });
The maximize
method is useful for dynamically maximizing windows and providing flexibility through event handling and callbacks.
The minimize method minimizes the current window. It triggers events before and after the window is minimized, allowing developers to respond to these events for custom behaviors.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnMinimize
: This event is triggered after the window is minimized.Events
OnMinimize
: Raised after the window is successfully minimized.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: Minimize . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
// Add Minimize event listener
function onMinimize(e) {
console.log('Window minimized:', e);
}
$fuse.addEvent('OnMinimize', onMinimize);
// Remove Minimize event listener
$fuse.removeEvent('OnMinimize', onMinimize);
// Clear all Minimize event listeners
$fuse.clearEvent('OnMinimize');
Example Usage
$fuse.minimize(function() {
console.log('Window has been minimized.');
}, { contextKey: 'exampleContext' });
The minimize
method is useful for dynamically minimizing windows and providing flexibility through event handling and callbacks.
The modal method sets the window's modal state, allowing the window to render modally or as a non-modal window. It triggers events before and after the modal state is set, enabling developers to respond to these changes.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
modal |
boolean |
Yes | Set to true to render the window modally; otherwise, set to false . |
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnModal
: This event is triggered after the window's modal state has been updated.Events
OnModal
: Raised after the window's modal state is set or removed.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: Modal . |
state |
object |
Indicates whether the window is modal (true ) or non-modal (false ). |
// Add Modal event listener
function onModal(e) {
console.log('Window modal state changed:', e);
}
$fuse.addEvent('OnModal', onModal);
// Remove Modal event listener
$fuse.removeEvent('OnModal', onModal);
// Clear all Modal event listeners
$fuse.clearEvent('OnModal');
Example Usage
$fuse.modal(true); // Renders the window modally.
$fuse.modal(false); // Removes the window's modal state.
The modal
method is useful for controlling the interaction of windows with other content, allowing developers to create focused user interactions.
The openPage method opens a page using the specified arguments, allowing developers to configure and control the page's behavior and appearance.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
settings |
PageSettings|string|number |
No | The page settings object, page identifier, or page system identifier. |
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
See Also
Refer to the PageSettings typedef for detailed descriptions of the page settings.
PageSettings Object
Property | Type | Optional | Description |
---|---|---|---|
id |
string |
Yes | The window identifier. |
title |
string |
Yes | The title of the page. |
titleIcon |
string |
Yes | The class name for the title icon. |
modal |
boolean |
Yes | Set to true to display the page modally; otherwise, set to false . |
parameters |
string |
Yes | A set of key/value pairs representing page parameters. |
width |
int |
Yes | The width of the page. |
height |
int |
Yes | The height of the page. |
left |
int |
Yes | The left position of the page. |
top |
int |
Yes | The top position of the page. |
maxBottom |
int |
Yes | The maximum bottom position of the page. |
minTop |
int |
Yes | The minimum top position of the page. |
contentUrl |
string |
Yes | The URL for the page content. |
state |
string |
Yes | The window state. Can be set to 'normal' , 'fullview' , 'snapped' , 'maximized' , or 'minimized' . |
snapBounds |
string |
Yes | The bounds to snap the window to (e.g., 'top' , 'left' , 'height' , 'width' , 'bottom' , 'right' ). |
UIPageId |
int |
Yes | The page identifier. |
SID |
string |
Yes | The page system identifier. |
UIApplicationId |
int |
Yes | The application identifier. |
UIApplicationSID |
string |
Yes | The application system identifier. |
events |
object |
Yes | Key-value pairs of event names and handlers (e.g., 'Close' , 'Resize' , 'Snapped' , 'Message' , etc.). |
eventContentUrl |
string |
Yes | Event record field for 'eventContentUrl' . |
eventUser1 |
string |
Yes | Event record field for 'user1' . |
eventUser2 |
string |
Yes | Event record field for 'user2' . |
eventUser3 |
string |
Yes | Event record field for 'user3' . |
eventUser4 |
string |
Yes | Event record field for 'user4' . |
eventUser5 |
string |
Yes | Event record field for 'user5' . |
eventContext |
object |
Yes | The context for the event. |
Example Usage
$fuse.openPage({
id: 'dashboard',
title: 'Dashboard',
contentUrl: '/dashboard.html',
width: 800,
height: 600,
modal: true,
state: 'normal',
events: {
Close: function() {
console.log('Dashboard window closed.');
},
Resize: function() {
console.log('Dashboard window resized.');
}
}
}, function() {
console.log('Dashboard page opened successfully.');
});
The openPage
method is a powerful tool for dynamically opening and configuring application pages within the Fuse Hub.
The pin method pins the current Fuse window, preventing it from being closed or moved. It triggers events before and after the pin operation, allowing developers to respond to these changes.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnPin
: This event is triggered after the window is successfully pinned.Events
OnPin
: Raised after the window is pinned.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: Pin . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
// Add Pin event listener
function onPin(e) {
console.log('Window pinned:', e);
}
$fuse.addEvent('OnPin', onPin);
// Remove Pin event listener
$fuse.removeEvent('OnPin', onPin);
// Clear all Pin event listeners
$fuse.clearEvent('OnPin');
Example Usage
$fuse.pin(function() {
console.log('Window has been pinned.');
}, { contextKey: 'exampleContext' });
The pin
method is useful for scenarios where a window needs to remain fixed in place, such as dashboards or critical user interfaces.
The restoreDown method returns the window to its previous state before it was maximized. It triggers events before and after the restore operation, allowing developers to respond to these changes.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnRestoreDown
: This event is triggered after the window is successfully restored to its previous state.Events
OnRestoreDown
: Raised after the window is restored down.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: RestoreDown . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
// Add RestoreDown event listener
function onRestoreDown(e) {
console.log('Window restored down:', e);
}
$fuse.addEvent('OnRestoreDown', onRestoreDown);
// Remove RestoreDown event listener
$fuse.removeEvent('OnRestoreDown', onRestoreDown);
// Clear all RestoreDown event listeners
$fuse.clearEvent('OnRestoreDown');
Example Usage
$fuse.restoreDown(function() {
console.log('Window has been restored to its previous state.');
}, { contextKey: 'exampleContext' });
The restoreDown
method is useful for managing window states dynamically, providing flexibility to restore a maximized window to its original size and position.
The restoreUp method returns the window to its previous state before it was minimized. It triggers events before and after the restore operation, allowing developers to respond to these changes.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnRestoreUp
: This event is triggered after the window is successfully restored to its previous state.Events
OnRestoreUp
: Raised after the window is restored up.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: RestoreUp . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
// Add RestoreUp event listener
function onRestoreUp(e) {
console.log('Window restored up:', e);
}
$fuse.addEvent('OnRestoreUp', onRestoreUp);
// Remove RestoreUp event listener
$fuse.removeEvent('OnRestoreUp', onRestoreUp);
// Clear all RestoreUp event listeners
$fuse.clearEvent('OnRestoreUp');
Example Usage
$fuse.restoreUp(function() {
console.log('Window has been restored to its previous state.');
}, { contextKey: 'exampleContext' });
The restoreUp
method is ideal for managing window states dynamically, providing flexibility to restore a minimized window to its original size and position.
The scrollbars method sets the document body's scrollbars based on the specified direction and value. It allows developers to control the visibility and behavior of the scrollbars dynamically.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
dir |
string |
Yes | The direction of the scrollbars. Valid values are: |
- 'both' : Both vertical and horizontal scrollbars. |
|||
- 'y' : The vertical scrollbar. |
|||
- 'x' : The horizontal scrollbar. |
|||
value |
string |
Yes | The scrollbar value to set. Common values include: |
- 'auto' : Scrollbars appear as needed. |
|||
- 'scroll' : Scrollbars are always visible. |
|||
- 'hidden' : Scrollbars are hidden. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
$fuse.scrollbars('both'); // Automatically show both scrollbars if needed.
$fuse.scrollbars('both', 'scroll'); // Always show both scrollbars.
$fuse.scrollbars('y', 'hidden'); // Hide the vertical scrollbar.
$fuse.scrollbars('x', 'auto'); // Show the horizontal scrollbar as needed.
The scrollbars
method is useful for controlling the appearance and behavior of scrollbars, enhancing user interface customization.
The setButtons method sets the window's buttons. Any previously added buttons will be removed before the new buttons are added. This allows developers to dynamically customize the buttons available on a window.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
buttons |
object.<string, eTag.Fuse.Button> |
No | An object containing button configurations keyed by button names. |
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Button Properties
The buttons
parameter accepts objects of type eTag.Fuse.Button
. Below are the properties available for each button:
Property | Type | Default | Description |
---|---|---|---|
id |
string |
button[n] |
The unique identifier for the button. |
text |
string |
button [n] |
The display text for the button. |
context |
string |
footer |
The button's context (header or footer ). |
enabled |
boolean |
true |
Indicates whether the button is enabled. |
display |
boolean |
true |
Indicates whether the button is visible. |
width |
string |
The width of the button. | |
index |
string |
The position index of the button. | |
displayExpression |
string |
An expression to determine whether the button is displayed. | |
enableExpression |
string |
An expression to determine whether the button is enabled. | |
commandExpression |
string |
An expression to execute when the button is pressed. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnSetButtons
: This event is triggered after the buttons are successfully set.Example Usage
$fuse.setButtons({
ok: { text: "Ok" },
cancel: { text: "Cancel" },
}, function () {
console.log("Buttons have been set.");
}, { contextKey: 'exampleContext' });
The setButtons
method is useful for dynamically customizing a window's buttons based on the application's context or user actions.
The setTitle method sets the title text of the Fuse window. It allows dynamic updates to the window's title based on application context or user actions.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
text |
object |
No | The new title text for the Fuse window. |
handler |
function |
Yes | A callback function invoked after the title is changed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnSetTitle
: This event is triggered after the title is successfully set.Events
OnSetTitle
: Raised after the window's title is updated.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: SetTitle . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
// Add SetTitle event listener
function onSetTitle(e) {
console.log('Title set:', e);
}
$fuse.addEvent('OnSetTitle', onSetTitle);
// Remove SetTitle event listener
$fuse.removeEvent('OnSetTitle', onSetTitle);
// Clear all SetTitle event listeners
$fuse.clearEvent('OnSetTitle');
Example Usage
$fuse.setTitle("New Window Title", function() {
console.log("Window title has been updated.");
}, { contextKey: 'exampleContext' });
The setTitle
method is ideal for customizing the window's title dynamically, providing clear context to the user about the window's purpose or content.
The share method allows sharing content based on the specified arguments. It is useful for facilitating content sharing within the Fuse ecosystem.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
args |
eTag.Fuse.ShareArgs |
No | The arguments containing the settings for the share operation. |
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Arguments
The args
parameter accepts an object of type eTag.Fuse.ShareArgs
with the following properties:
Property | Type | Description |
---|---|---|
pageId |
string |
The identifier of the page to be shared. |
pageSID |
string |
The system identifier of the page to be shared. |
contentUrl |
string |
The URL of the content to be shared. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnSaveEvent
: This event is triggered after the share operation is successfully completed.Example Usage
$fuse.share({
pageId: "12345",
pageSID: "abcde-67890",
contentUrl: "https://example.com/content",
}, function () {
console.log("Content has been shared successfully.");
}, { contextKey: 'exampleContext' });
The share
method is a versatile tool for enabling content sharing, making it easier to distribute resources or information across the Fuse platform.
The show method displays the current Fuse window, making it visible to the user. It triggers associated events to allow developers to perform actions during the window's show process.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnShow
: This event is triggered after the window is successfully shown.Events
OnShow
: Raised after the window is displayed.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: Show . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
// Add Show event listener
function onShow(e) {
console.log('Window shown:', e);
}
$fuse.addEvent('OnShow', onShow);
// Remove Show event listener
$fuse.removeEvent('OnShow', onShow);
// Clear all Show event listeners
$fuse.clearEvent('OnShow');
Example Usage
$fuse.show(function () {
console.log("Window is now visible.");
}, { contextKey: 'exampleContext' });
The show
method is useful for ensuring that hidden windows are made visible to the user, supporting dynamic UI interactions.
The snap method adjusts the current Fuse window's position and size based on the specified bounds. It triggers events to allow custom behaviors during and after the snap operation.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
bounds |
object |
No | The bounds defining the window's position and size. |
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnSnap
: This event is triggered after the window's snap state is successfully changed.Events
OnSnap
: Raised after the window's snap state is updated.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: Snap . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
// Add Snap event listener
function onSnap(e) {
console.log('Window snapped:', e);
}
$fuse.addEvent('OnSnap', onSnap);
// Remove Snap event listener
$fuse.removeEvent('OnSnap', onSnap);
// Clear all Snap event listeners
$fuse.clearEvent('OnSnap');
Example Usage
$fuse.snap({
left: 100,
top: 50,
width: 800,
height: 600
}, function () {
console.log("Window snap state updated.");
}, { contextKey: 'exampleContext' });
The snap
method is particularly useful for arranging windows dynamically to maintain a clean and organized user interface.
The unpin method releases the current Fuse window from its pinned state, allowing it to move freely. Events are triggered during and after the operation to enable custom behaviors.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnUnpin
: This event is triggered after the window is successfully unpinned.Events
OnUnpin
: Raised after the window is unpinned.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: Unpin . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
// Add Unpin event listener
function onUnpin(e) {
console.log('Window unpinned:', e);
}
$fuse.addEvent('OnUnpin', onUnpin);
// Remove Unpin event listener
$fuse.removeEvent('OnUnpin', onUnpin);
// Clear all Unpin event listeners
$fuse.clearEvent('OnUnpin');
Example Usage
$fuse.unpin(function () {
console.log("Window is now unpinned.");
}, { contextKey: 'exampleContext' });
The unpin
method is useful for dynamically modifying the positioning behavior of a window in the UI.
The updateButtons method refreshes the current window's buttons, ensuring that their states, visibility, and configurations are updated dynamically. This method triggers events to allow custom behaviors during and after the update process.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
handler |
function |
Yes | A callback function invoked after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Fires
OnUpdateButtons
: This event is triggered after the window's buttons are successfully updated.Events
OnUpdateButtons
: Raised after the window's buttons are updated.
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: UpdateButtons . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
// Add UpdateButtons event listener
function onUpdateButtons(e) {
console.log('Window buttons updated:', e);
}
$fuse.addEvent('OnUpdateButtons', onUpdateButtons);
// Remove UpdateButtons event listener
$fuse.removeEvent('OnUpdateButtons', onUpdateButtons);
// Clear all UpdateButtons event listeners
$fuse.clearEvent('OnUpdateButtons');
Example Usage
$fuse.updateButtons(function () {
console.log("Window buttons have been updated.");
}, { contextKey: 'exampleContext' });
The updateButtons
method is particularly useful for dynamically altering button states or appearances in response to user interactions or system events.
The activeUIWorkspaceId property allows you to get the identifier for the currently active workspace of the user. Workspaces are used to organize and manage user-specific views and shortcuts within the eTag Fuse environment.
Data Type
number
Version
Usage
The property can be accessed directly to retrieve the active workspace ID.
Example Usage
Retrieve the Active Workspace ID:
let activeWorkspaceId = $fuse.activeUIWorkspaceId;
console.log(activeWorkspaceId); // Outputs the ID of the currently active workspace.
This property is fundamental for managing user workspaces effectively and for implementing workspace-related customizations.
The buttons property retrieves the buttons associated with the current window. Each button is represented as an object containing attributes that define its behavior and appearance.
Data Type
object.<string, eTag.Fuse.Button>
Version
Usage
This property is used to configure or query the buttons of the current window. Buttons can be displayed in the header or footer, enabled or disabled, and customized with expressions for dynamic behaviors.
Button Object Attributes
'button[n]'
.'button [n]'
.'header'
or 'footer'
. Default: 'footer'
.true
.true
.Example Usage
Log All Buttons:
console.log("Window Buttons:", $fuse.buttons);
Enable a Button:
if ($fuse.buttons.saveButton) {
$fuse.buttons.saveButton.enabled = true;
}
Add Dynamic Behavior to a Button:
$fuse.buttons.saveButton.enableExpression = "someCondition == true";
$fuse.buttons.saveButton.commandExpression = "saveData()";
The isActive property indicates whether the embedded Fuse window is currently active.
Data Type
boolean
Version
Usage
This property is used to check if the embedded Fuse window is active. It is useful for managing application behavior based on window state.
Example Usage
Check if Window is Active:
if ($fuse.isActive) {
console.log("The Fuse window is active.");
} else {
console.log("The Fuse window is inactive.");
}
The originGuid property represents the global unique identifier (GUID) of the Fuse window that originated the current window.
Data Type
string
Version
Usage
This property is used to track the originating Fuse window that created or opened the current window.
Example Usage
Log Origin GUID:
console.log("Originating Window GUID:", $fuse.originGuid);
The parameters property retrieves the list of parameters associated with the current context. Each parameter is represented as a key-value pair, such as { "firstName": "sam" }
.
Data Type
array
Version
Usage
The property can be used to access the list of parameters passed in the current session or context. Each parameter object contains keys and their respective values.
Example Usage
Retrieve Parameters:
let params = $fuse.parameters;
console.log(params); // Outputs the array of key-value pairs.
Iterate Through Parameters:
for (var key in $fuse.parameters) {
console.log(`Key: ${key}, Value: ${$fuse.parameters[key]}`);
}
This property is useful for handling dynamic data in various contexts, ensuring that parameters are easily accessible and modifiable as needed.
The uIAPIOptions property retrieves the user interface API options for the current context. The property value is a bitwise combination of flags that determine how the Fuse API (fuse.js) communicates with the application.
Data Type
number
Version
Usage
The property is used to configure and retrieve settings for the Fuse API communication. The bit flags for the property value are as follows:
Example Usage
Retrieve API Options:
let apiOptions = $fuse.uIAPIOptions;
console.log(apiOptions); // Outputs the bitwise value representing the options.
Check API Option Flags:
if ($fuse.uIAPIOptions & 1) {
console.log("Fuse API communication is enabled.");
}
if ($fuse.uIAPIOptions & 2) {
console.log("Sensitive security details are suppressed.");
}
This property ensures that the Fuse API communication behavior is configurable and context-aware.
The uIApplicationId property retrieves the application identifier associated with the current window or page. This identifier is unique to the application instance within the Fuse environment.
Data Type
number
Version
Usage
This property is used to identify and interact with the application instance tied to the current Fuse window or context.
Example Usage
Retrieve the Application ID:
let appId = $fuse.uIApplicationId;
console.log(appId); // Outputs the application ID associated with the window or application.
The uIOptions property retrieves the user interface options associated with the current application or window. These options are represented as bit flags that define the UI behavior and compatibility.
Data Type
number
Version
Bit Flags
The following bit flags define the possible values of this property:
Usage
Use this property to determine or modify the behavior of the UI based on the application environment and compatibility requirements.
Example Usage
Retrieve UI Options:
let options = $fuse.uIOptions;
console.log(options); // Outputs the current UI options bit flags.
Check Specific Options:
if (options & 1) {
console.log("The interface is not supported on phones.");
}
if (options & 4) {
console.log("The interface is not supported on desktops.");
}
The uIPageId property retrieves the unique identifier associated with the user interface page.
Data Type
number
Version
Usage
Use this property to obtain the unique identifier for the current UI page, which can be used for tracking, referencing, or performing operations specific to the page.
Example Usage
Retrieve UI Page ID:
let pageId = $fuse.uIPageId;
console.log(pageId); // Outputs the unique identifier of the current page.
The uIPageSID property retrieves the system identifier associated with the user interface page.
Data Type
number
Version
Usage
This property is used to obtain the system identifier for the current UI page, which can be utilized for operations requiring a standardized or system-wide reference.
Example Usage
Retrieve UI Page SID:
let pageSID = $fuse.uIPageSID;
console.log(pageSID); // Outputs the system identifier of the current page.
The uIWorkspaceId property retrieves the identifier associated with the user interface workspace.
Data Type
number
Version
Usage
This property is used to obtain the workspace identifier for the current UI context. It can be utilized to manage or reference specific workspaces within the application.
Example Usage
Retrieve UI Workspace ID:
let workspaceId = $fuse.uIWorkspaceId;
console.log(workspaceId); // Outputs the identifier of the current workspace.
The windowGuid property retrieves the global unique identifier (GUID) associated with the current window.
Data Type
string
Version
Usage
This property is used to uniquely identify the current window instance. It can be helpful for distinguishing between multiple windows or managing window-specific settings.
Example Usage
Retrieve Window GUID:
let guid = $fuse.windowGuid;
console.log(guid); // Outputs the global unique identifier of the current window.
This section provides members for managing navigation and shortcuts within the Fuse hub. These members allow developers to programmatically navigate between pages, manage navigation items, and customize shortcuts for improved user accessibility and workflow efficiency.
These members simplify and enhance user experiences by streamlining navigation tasks and making applications more intuitive and user-friendly.
The invokeNavigation method allows developers to trigger navigation within the application by using a specified navigation identifier.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
settings | object |
No | The navigation settings, including identifiers and configuration options. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
$fuse.invokeNavigation({id: 'dashboard'});
This method provides a simple way to programmatically trigger navigational actions within the application, ensuring consistent behavior with predefined navigation rules.
The navigate method enables navigation to a specified URL or page by using a URL string or a set of page settings.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
args | PageSettings or string |
No | The page settings object or the URL to navigate to. |
PageSettings
A set of key-value pairs that define the page settings:
Property | Type | Description |
---|---|---|
id |
string |
The window identifier. |
title |
string |
The title of the page. |
titleIcon |
string |
The title icon class name. |
modal |
boolean |
Set to true to display the page modally; otherwise false . |
parameters |
string |
A set of key-value pairs representing page parameters. |
width |
int |
The width of the page. |
height |
int |
The height of the page. |
left |
int |
The left position. |
top |
int |
The top position. |
maxBottom |
int |
The maximum bottom position. |
minTop |
int |
The minimum top position. |
contentUrl |
string |
The content URL of the page. |
state |
string |
The window state (normal , fullview , snapped , maximized , minimized ). |
snapBounds |
string |
The bounds to snap the window (top , left , height , width , bottom , right ). |
UIPageId |
int |
The page identifier. |
SID |
string |
The page system identifier. |
UIApplicationId |
int |
The application identifier. |
UIApplicationSID |
string |
The application system identifier. |
events |
object |
Key-value pair of event names and handlers (e.g., Close , ButtonClick ). |
eventContentUrl |
string |
The 'eventContentUrl' event record field. |
eventUser1 |
string |
The 'user1' event record field. |
eventUser2 |
string |
The 'user2' event record field. |
eventUser3 |
string |
The 'user3' event record field. |
eventUser4 |
string |
The 'user4' event record field. |
eventUser5 |
string |
The 'user5' event record field. |
eventContext |
object |
The event context. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Navigate using a URL string:
$fuse.navigate('https://www.example.com');
Navigate using PageSettings
:
$fuse.navigate({
id: 'dashboard',
title: 'Dashboard Page',
contentUrl: '/dashboard',
parameters: { user: 'JohnDoe' }
});
The reloadNavbar method reloads the navigation bar, with an option to render the entire navigation bar or only specific parts.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
all | boolean |
No | A value indicating whether to render the entire navigation bar (true ) or not. |
handler | function |
Yes | A callback function to invoke after the operation is completed. |
userContext | object |
Yes | Additional information to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Events
OnReloadNavbar
: Triggered after the navigation bar is reloaded.Event Example Usage
Add ReloadNavbar
event listener:
function onReloadNavbar(e) {
console.log('Navigation bar reloaded:', e);
}
$fuse.addEvent('OnReloadNavbar', onReloadNavbar);
Remove an existing ReloadNavbar
event listener:
$fuse.removeEvent('OnReloadNavbar', onReloadNavbar);
Clear all ReloadNavbar
event listeners:
$fuse.clearEvent('OnReloadNavbar');
Example Usage
Reload the entire navigation bar:
$fuse.reloadNavbar(true);
Reload specific parts of the navigation bar:
$fuse.reloadNavbar(false);
The saveFavorite method saves an entry to the user's favorites with the specified settings.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
args | SaveFavoriteArgs |
No | The arguments to configure the favorite entry. |
handler | function |
Yes | A callback function to invoke after the operation is completed. |
userContext | object |
Yes | Additional information to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Arguments for SaveFavoriteArgs
Property | Type | Description |
---|---|---|
title | string |
The title text for the favorite. |
description | string |
The description text for the favorite. |
pageSID | string |
The page system identifier. |
contentUrl | string |
The content URL. |
Events
OnSaveEvent
: Triggered after a favorite entry is successfully saved.Event Example Usage
Add SaveEvent
event listener:
function onSaveEvent(e) {
console.log('Favorite saved:', e);
}
$fuse.addEvent('OnSaveEvent', onSaveEvent);
Remove an existing SaveEvent
event listener:
$fuse.removeEvent('OnSaveEvent', onSaveEvent);
Clear all SaveEvent
event listeners:
$fuse.clearEvent('OnSaveEvent');
Example Usage
Save an entry to the user's favorites:
$fuse.saveFavorite({
title: 'Dashboard',
description: 'Quick access to the dashboard page.',
pageSID: '12345',
contentUrl: '/dashboard'
});
The setShortcut method creates a shortcut on the active workspace using the specified settings.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
shortcut | eTag.Fuse.Shortcut |
No | The shortcut settings to configure the workspace shortcut. |
handler | function |
Yes | A callback function to invoke after the operation is completed. |
userContext | object |
Yes | Additional information to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Arguments for Shortcut
Property | Type | Description |
---|---|---|
targetPage | string |
The target page identifier or SID. |
title | string |
The title of the shortcut. |
icon | string |
The icon for the shortcut. |
iconOptions | string |
Additional icon options. |
iconColor | string |
The color of the icon. |
contentUrl | string |
The content URL for the shortcut. |
parameters | object |
Key-value pairs for additional parameters. |
Events
OnSetShortcut
: Triggered after a shortcut is successfully created.Event Details
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: setShortcut . |
response |
eTag.Fuse.RPCResponse |
The remote procedure call response. |
Event Example Usage
Add SetShortcut
event listener:
function onSetShortcut(e) {
console.log('Shortcut created:', e);
}
$fuse.addEvent('OnSetShortcut', onSetShortcut);
Remove an existing SetShortcut
event listener:
$fuse.removeEvent('OnSetShortcut', onSetShortcut);
Clear all SetShortcut
event listeners:
$fuse.clearEvent('OnSetShortcut');
Example Usage
Create a shortcut on the active workspace:
$fuse.setShortcut({
targetPage: '12345',
title: 'Dashboard',
icon: 'dashboard-icon',
iconColor: 'blue',
contentUrl: '/dashboard',
parameters: {
view: 'summary'
}
});
This section provides members for enabling seamless interaction between applications and components within the Fuse ecosystem. These members facilitate real-time communication, event handling, and resource sharing across the UI.
These members streamline application interoperability and enhance user workflows within the Fuse Hub.
The appMessage method sends a message to the hosting eTag Fuse application (e.g., Fuse for Desktop) for processing using the specified arguments, callback method, and additional user context.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
message | object |
No | The message arguments to send to the hosting application. |
handler | function |
Yes | A callback function to invoke after the application processes the message. |
userContext | object |
Yes | Additional information to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Send a message to the hosting Fuse application:
$fuse.appMessage({
type: 'UpdateSettings',
data: {
theme: 'dark-mode',
notificationsEnabled: true
}
}, function(response) {
console.log('Application Response:', response);
}, { context: 'UIUpdate' });
The attachFrames method attaches specified iframe DOM elements or all available iframes if none are provided.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
frames | array |
Yes | An array of references to iframe DOM elements to attach. Leave empty to attach all iframes. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Attach specific iframe elements:
const frame1 = document.getElementById('iframe1');
const frame2 = document.getElementById('iframe2');
$fuse.attachFrames([frame1, frame2]);
Attach all iframes:
$fuse.attachFrames();
The broadcast method sends a message to all connected windows. It facilitates seamless communication between windows within the eTag Fuse ecosystem.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
data | object |
Yes | The data to broadcast. |
handler | function |
Yes | A callback function to invoke after the operation is completed. |
userContext | object |
Yes | Additional information to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Broadcast a simple message:
$fuse.broadcast({ message: 'Hello, Fuse!' });
Broadcast with a callback:
$fuse.broadcast({ message: 'Hello, Fuse!' }, (response) => {
console.log('Broadcast completed:', response);
});
Events
OnAfterBroadcast
This event is triggered after a broadcast message has been sent.
Property | Type | Description |
---|---|---|
type | string |
The message type. Value: AfterBroadcast . |
sessions | string[] |
An array of session identifiers of connections that received the broadcast. |
Examples
Add an event listener:
function onAfterBroadcast(e) {
console.log('Broadcast sent to sessions:', e.sessions);
}
$fuse.addEvent('OnAfterBroadcast', onAfterBroadcast);
Remove an event listener:
$fuse.removeEvent('OnAfterBroadcast', onAfterBroadcast);
Remove all event listeners:
$fuse.clearEvent('OnAfterBroadcast');
OnBroadcast
This event is triggered when a broadcast message is received by another window.
Property | Type | Description |
---|---|---|
type | string |
The message type. Value: Broadcast . |
data | object |
The data received from the broadcast. |
sessionId | string |
The originating session identifier. |
scope | string |
The scope of the broadcast (connections , sibling , children , application , or global ). Default is connections . |
Examples
Add an event listener:
function onBroadcast(e) {
console.log('Received broadcast message:', e.data);
}
$fuse.addEvent('OnBroadcast', onBroadcast);
Remove an event listener:
$fuse.removeEvent('OnBroadcast', onBroadcast);
Remove all event listeners:
$fuse.clearEvent('OnBroadcast');
The connect method establishes a connection with a target Fuse window using its unique identifier. This facilitates communication and interaction between Fuse windows.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
targetGuid | string |
No | The global unique identifier of the target Fuse window. |
arguments | object |
Yes | Additional information to pass to the target Fuse window. |
handler | function |
Yes | A callback function to invoke after the operation is completed. |
userContext | object |
Yes | Additional information to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Establish a connection to a Fuse window:
$fuse.connect('unique-window-guid', { customData: 'example' }, function (response) {
if (response.state === 'connected') {
console.log('Connected successfully!');
} else {
console.error('Connection failed:', response.reason);
}
});
Events
OnConnect
This event is triggered after a connection attempt is made.
Property | Type | Description |
---|---|---|
type | string |
The message type. Value: Connect . |
targetGuid | string |
The global unique identifier of the target Fuse window. |
state | string |
Connection state: connected , error , or denied . |
reason | string |
Reason for the error or denial, if applicable. |
features | string |
Available features on the target Fuse window. |
Examples
Add an event listener:
function onConnect(e) {
if (e.state === 'connected') {
console.log('Connected to target window:', e.targetGuid);
} else {
console.error('Connection error:', e.reason);
}
}
$fuse.addEvent('OnConnect', onConnect);
Remove an event listener:
$fuse.removeEvent('OnConnect', onConnect);
Remove all event listeners:
$fuse.clearEvent('OnConnect');
OnConnectionRequest
This event is triggered when an incoming connection request is received.
Property | Type | Description |
---|---|---|
type | string |
The message type. Value: ConnectionRequest . |
callerGuid | string |
The unique identifier of the requesting Fuse window. |
accept | boolean |
Set to true (default) to accept or false to deny the connection. |
reason | string |
Reason for denying the connection, if applicable. |
arguments | object |
Additional information passed by the requesting Fuse window. |
Examples
Add an event listener:
function onConnectionRequest(e) {
if (e.callerGuid === 'allowed-window-guid') {
e.accept = true;
} else {
e.accept = false;
e.reason = 'Unauthorized connection attempt';
}
}
$fuse.addEvent('OnConnectionRequest', onConnectionRequest);
Remove an event listener:
$fuse.removeEvent('OnConnectionRequest', onConnectionRequest);
Remove all event listeners:
$fuse.clearEvent('OnConnectionRequest');
OnNeedFeatures
This event is triggered after a connection is successfully established, enabling the definition of features available to other Fuse windows.
Property | Type | Description |
---|---|---|
features | eTag.Fuse.FeatureType[] |
Definitions for the features available to callers. |
Examples
Define features for connected windows:
function onNeedFeatures(e) {
e.features = [
{
name: 'getCustomer',
parameters: [{ name: 'id' }],
procedure: function (id) {
if (id === 5) {
return { name: 'John Doe', accountNo: 123124, balanceDue: 129.99 };
} else {
throw 'Invalid customer ID.';
}
}
}
];
}
$fuse.addEvent('OnNeedFeatures', onNeedFeatures);
Remove an event listener:
$fuse.removeEvent('OnNeedFeatures', onNeedFeatures);
Remove all event listeners:
$fuse.clearEvent('OnNeedFeatures');
The connection method retrieves a specific connection based on the provided key. This can be an index, name, target GUID, or session identifier.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
key | string | number |
Yes | The index, name, target GUID, or session identifier of the connection to retrieve. |
handler | function |
Yes | A callback function to invoke after the operation is completed. |
userContext | object |
Yes | Additional information to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Retrieve a connection by its session identifier:
$fuse.connection('session-id-12345', function (response) {
if (response) {
console.log('Connection details:', response);
} else {
console.error('Connection not found.');
}
});
Retrieve a connection by its index:
$fuse.connection(0, function (response) {
console.log('First connection details:', response);
});
Event Integration
You can use this method in conjunction with connection-related events, such as OnConnect
or OnConnectionRequest
, to dynamically retrieve and manage connections based on user actions or system events.
This method is useful for inspecting or interacting with a specific Fuse window connection in a complex multi-window environment.
The detachFrames method detaches specified frames from the current Fuse window. If no frames are provided, all frames will be detached.
The detachFrames
method is useful for managing iframe elements within the current Fuse window, particularly when cleaning up resources or reinitializing content dynamically. By detaching frames, their association with the current Fuse window is removed, reducing dependencies and potential performance overhead.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
frames | array |
Yes | An array of references to iframe DOM elements to detach. Leave empty to detach all frames. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Detach specific frames:
const framesToDetach = [document.getElementById('frame1'), document.getElementById('frame2')];
$fuse.detachFrames(framesToDetach);
Detach all frames:
$fuse.detachFrames();
The disconnect method terminates a connection with a specified Fuse window. If no key is provided, all active connections will be terminated.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
key | string\|number |
Yes | The index, name, target global unique identifier, or session identifier of the connection to terminate. Leave empty to terminate all connections. |
handler | function |
Yes | A callback function to invoke after the operation is completed. |
userContext | object |
Yes | Additional information to pass to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Terminate a specific connection:
$fuse.disconnect('session123');
Terminate all connections:
$fuse.disconnect();
Description
The disconnect
method allows applications to gracefully terminate one or more connections to other Fuse windows. It can be used to manage resources and ensure that unnecessary or idle connections are properly closed.
Events
The disconnect
method raises the following events:
This event is triggered when a connection is being terminated.
Property | Type | Description |
---|---|---|
type | string |
The message type. Value: Disconnect. |
cancel | boolean |
Set to true to cancel the disconnection; otherwise false . Default: false . |
session | eTag.Fuse.Session |
The session to disconnect from. |
Examples
Add an OnDisconnect event listener:
function onDisconnect(e) {
console.log('Disconnected session:', e.session);
}
$fuse.addEvent('OnDisconnect', onDisconnect);
Remove an existing OnDisconnect event listener:
$fuse.removeEvent('OnDisconnect', onDisconnect);
Clear all OnDisconnect event listeners:
$fuse.clearEvent('OnDisconnect');
The disconnect
method and its associated events provide fine-grained control over the termination of connections, making it essential for robust and dynamic application communication.
The fetch method allows sending network requests to a remote endpoint and dynamically loading new information as needed. It supports HTTP data transfer methods such as GET
, POST
, or HEAD
.
The fetch
method simplifies making HTTP requests, allowing applications to interact with remote endpoints and retrieve or send data dynamically. It supports all standard HTTP verbs, making it versatile for various use cases.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
arguments | eTag.Fuse.FetchArgs |
No | A set of key/value pairs containing the request details. |
handler | function |
Yes | A callback function to invoke after the request is completed. |
userContext | object |
Yes | Additional information to pass to event listeners or the callback function. |
The FetchArgs object contains the following properties:
Property | Type | Optional | Description |
---|---|---|---|
url | string |
Yes | The resource address. |
verb | string |
Yes | The HTTP method to use (e.g., GET, POST, HEAD). |
data | string |
Yes | The request data to send to the endpoint. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Send a GET
request:
$fuse.fetch({
url: 'https://api.example.com/data',
verb: 'GET'
}, function(response) {
console.log('Response:', response);
});
Send a POST
request with data:
$fuse.fetch({
url: 'https://api.example.com/data',
verb: 'POST',
data: JSON.stringify({ id: 123, name: 'John Doe' })
}, function(response) {
console.log('Response:', response);
});
Events
The fetch
method raises the following events:
This event is triggered after a fetch request is completed.
Property | Type | Description |
---|---|---|
type | string |
The message type. Value: Fetch. |
response | object |
The response data returned by the endpoint. |
status | number |
The HTTP status code of the response. |
Examples
Add an OnFetch event listener:
function onFetch(e) {
console.log('Fetch response:', e.response);
}
$fuse.addEvent('OnFetch', onFetch);
Remove an existing OnFetch event listener:
$fuse.removeEvent('OnFetch', onFetch);
Clear all OnFetch event listeners:
$fuse.clearEvent('OnFetch');
The fetch
method, combined with its events, provides a powerful way to perform network requests and handle responses efficiently in Fuse applications.
The message method sends a message into the eTag Fuse platform pipeline for processing using the specified arguments and callback method.
The message
method is used to send a message into the eTag Fuse platform's processing pipeline. This enables interaction with the platform's core functionalities and workflows, allowing applications to trigger processes or respond to events dynamically.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
message | object |
No | The message arguments to process. |
handler | function |
Yes | The callback method to invoke after a platform response. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Send a message into the platform pipeline:
$fuse.message(
{ action: 'exampleAction', data: 'sampleData' },
function(response) {
console.log('Platform Response:', response);
}
);
This section provides a suite of tools to seamlessly integrate voice commands and speech recognition capabilities into applications. These members enable a more natural and intuitive way for users to interact with applications through spoken language.
By incorporating these members, applications can enhance user accessibility, improve user experience, and adopt a cutting-edge interaction paradigm.
The abortSpeechRecognition method stops the speech recognition service from listening to incoming audio and does not process or return results based on the audio captured so far.
The abortSpeechRecognition
method is used to terminate the speech recognition service prematurely. This is useful when the application needs to stop capturing audio without processing the captured input further. This method ensures that no results are returned from the interrupted session.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Abort the speech recognition service:
$fuse.abortSpeechRecognition();
The startSpeechRecognition method initiates the speech recognition service, allowing the application to listen to incoming audio and process it according to the specified settings.
The startSpeechRecognition
method activates the speech recognition service and begins processing incoming audio input. Developers can configure settings for continuous recognition, interim results, and language preferences. Events can be added to handle the output and lifecycle of the recognition session.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
settings |
eTag.Fuse.SpeechRecognitionSettings |
Yes | An object containing the speech recognition settings, such as language, whether to enable continuous recognition, and whether to return interim results. |
Returns
Returns the $fuse
object, enabling method chaining.
SpeechRecognitionSettings
Property | Type | Default | Description |
---|---|---|---|
continuous |
boolean |
true |
Indicates if continuous results should be returned for each recognition session. |
interimResults |
boolean |
true |
Indicates if interim results should be returned during recognition. |
lang |
string |
en-US |
Specifies the language or dialect to be used for recognition (e.g., en-US for English). |
Example Usage
Start the speech recognition service with default settings:
$fuse.startSpeechRecognition();
Start the speech recognition service with custom settings:
$fuse.startSpeechRecognition({
continuous: true,
interimResults: true,
lang: 'en-GB'
});
Example: Add Event Listener
function onStartSpeechRecognition(e) {
console.log('Speech recognition started!');
}
$fuse.addEvent("OnStartSpeechRecognition", onStartSpeechRecognition);
The stopSpeechRecognition method halts the speech recognition service from listening to incoming audio and attempts to process and return a speech recognition result using the audio captured so far.
The stopSpeechRecognition
method ends the audio capturing process initiated by the speech recognition service and processes the captured audio to return the final recognition result. This method is typically used to conclude a speech recognition session.
Parameters
None.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Stop the speech recognition service:
$fuse.stopSpeechRecognition();
Example: Add Event Listener
function onStopSpeechRecognition(e) {
console.log('Speech recognition stopped!');
}
$fuse.addEvent("OnStopSpeechRecognition", onStopSpeechRecognition);
This section provides mechanisms to secure and control user interactions with application resources or workflows. These members allow developers to lock content or UI elements based on specific conditions.
These members enhance security and ensure controlled access to application features.
The acquireLock method requests an exclusive lock on the current window, preventing other processes from accessing or modifying it. This ensures data integrity and avoids conflicting actions that could compromise the reliability of the information being processed.
By obtaining an exclusive lock, the acquireLock
method safeguards resources, enabling secure and conflict-free operations within the application.
Name | Type | Optional | Description |
---|---|---|---|
instanceId |
function |
Yes | The instance identifier for the lock. |
handler |
function |
Yes | A callback function to execute after the lock is acquired. |
userContext |
object |
Yes | Additional information passed to event listeners or the callback function. |
Returns the $fuse
object, enabling method chaining.
OnAcquireLock
: Triggered after the exclusive lock is successfully acquired.Acquire a lock on the current window:
$fuse.acquireLock(instanceId, function () {
console.log("Lock acquired!");
});
function onAcquireLock(e) {
console.log("Exclusive lock acquired.");
}
$fuse.addEvent("OnAcquireLock", onAcquireLock);
$fuse.removeEvent("OnAcquireLock", onAcquireLock);
$fuse.clearEvent("OnAcquireLock");
The extendLock method prolongs the duration of an existing lock, ensuring continued exclusive access to the current window or resource. This helps maintain data integrity during extended operations.
The extendLock
method allows applications to prevent lock expiration by increasing the lock duration for a specified period.
Name | Type | Optional | Description |
---|---|---|---|
extendTime |
function |
Yes | The amount of time in minutes to extend the lock. |
handler |
function |
Yes | A callback function to execute after the lock is extended. |
userContext |
object |
Yes | Additional information passed to event listeners or the callback function. |
Returns the $fuse
object, enabling method chaining.
OnExtendLock
: Triggered after the lock is successfully extended.Extend the lock duration by 10 minutes:
$fuse.extendLock(10, function () {
console.log("Lock duration extended!");
});
function onExtendLock(e) {
console.log("Lock extended successfully.");
}
$fuse.addEvent("OnExtendLock", onExtendLock);
$fuse.removeEvent("OnExtendLock", onExtendLock);
$fuse.clearEvent("OnExtendLock");
The isLocked method checks whether the screen or record is currently locked. This is useful for determining the lock state before performing operations that require exclusive access.
The isLocked
method returns a boolean value indicating whether a lock is currently active.
None.
Returns a boolean
:
true
: Indicates that the screen or record is locked.false
: Indicates that no lock is active.Check if the screen or record is locked:
if ($fuse.isLocked()) {
console.log("The screen is currently locked.");
} else {
console.log("No active lock detected.");
}
This section enables developers to manage and access application resources dynamically. These members allow loading, updating, and interacting with resources in real-time.
These members ensure efficient and flexible resource management within applications.
The loadResource method dynamically loads a specified resource, such as a script or stylesheet, into the application. This is particularly useful for adding external dependencies or custom resources during runtime.
The loadResource
method facilitates the loading of external resources by specifying their URIs and settings. It supports both individual and multiple resource loading, enhancing the application's dynamic behavior.
Name | Type | Optional | Description |
---|---|---|---|
uri |
string or array |
No | The Uniform Resource Identifier (URI) of the resource(s) to load. Can be a single URI string or an array of URIs for multiple resources. |
settings |
ResourceSettings |
Yes | A set of key/value pairs for configuring the resource loading behavior. See ResourceSettings for details. |
Property | Type | Default | Description |
---|---|---|---|
type |
string |
Specifies the resource type: 'style' or 'script' . If omitted, the type is determined from the file extension. |
|
preload |
boolean |
false |
If true, initiates early fetch without executing the resource immediately. |
async |
boolean |
true |
If true, the script runs asynchronously once available. |
defer |
boolean |
false |
If true, the script runs only after the page has fully loaded. |
Returns the $fuse
object, enabling method chaining.
Load a single resource
$fuse.loadResource('https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js');
Load multiple resources
$fuse
.loadResource('https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js')
.loadResource('https://ajax.googleapis.com/ajax/libs/hammerjs/2.0.8/hammer.min.js')
.loadResource('https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js', { async: false });
Load multiple resources using an array
$fuse.loadResource([
'https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js',
'https://ajax.googleapis.com/ajax/libs/hammerjs/2.0.8/hammer.min.js',
'https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js'
]);
The resource method checks if a specified resource has already been loaded and retrieves it if available.
The resource
method verifies whether a resource, identified by its URL, has been successfully loaded. If the resource exists, it returns the resource object; otherwise, it returns null
.
Name | Type | Optional | Description |
---|---|---|---|
url |
string |
No | The URL of the resource to check. |
Returns the resource object if it exists; otherwise, returns null
.
Check and retrieve a loaded resource
const resource = $fuse.resource('https://example.com/styles.css');
if (resource) {
console.log('Resource exists:', resource);
} else {
console.log('Resource not found.');
}
This section provides tools for customizing and managing the visual appearance of applications. These members enable developers to apply themes dynamically, creating a consistent and personalized user experience.
These members empower developers to create visually engaging and consistent applications.
The applyTheme method applies a specified theme to customize the appearance and behavior of the application.
The applyTheme
method allows developers to apply a theme, adjusting visual and functional aspects such as zoom level, brightness, text size, and additional resources. Themes enhance the user experience by aligning the interface with specific design or accessibility requirements.
Name | Type | Optional | Description |
---|---|---|---|
theme |
eTag.Fuse.Theme |
Yes | The theme to apply. |
The eTag.Fuse.Theme
object includes the following properties:
Property | Type | Description |
---|---|---|
themeKey |
int|string |
The identifier for the theme. |
zoom |
int |
The zoom level to apply. |
brightness |
int |
The brightness level to apply. |
shortcutsClass |
string |
The class defining the appearance of shortcuts. |
textSizeClass |
string |
The class defining the text size. |
resources |
array |
An array of additional resources for the theme. |
Returns the $fuse
object, enabling method chaining.
Apply a theme with custom properties
$fuse.applyTheme({
themeKey: 101,
zoom: 125,
brightness: 80,
shortcutsClass: 'shortcuts-dark',
textSizeClass: 'text-large',
resources: ['https://example.com/theme.css']
});
The loadTheme method loads the user's theme settings to customize the application's appearance based on individual preferences.
The loadTheme
method retrieves and applies a user's saved theme, including settings such as zoom level, brightness, and resource styles. This method ensures that the application's interface reflects the user's desired visual preferences.
Name | Type | Optional | Description |
---|---|---|---|
handler |
function |
Yes | A callback function to execute after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns the $fuse
object, enabling method chaining.
Load the user's theme
$fuse.loadTheme((theme) => {
console.log('Theme loaded:', theme);
});
This section focuses on enabling responsive and dynamic interactions within the user interface. These members provide tools for managing content, user input, and interactive elements.
These members ensure a fluid and interactive user experience within the Fuse ecosystem.
The blocker method displays or hides a content blocker overlay on the page, restricting user interaction with underlying elements.
The blocker
method is used to manage a content blocker, which serves as an overlay to temporarily restrict access to the page's content. This can be useful during loading processes, modal displays, or sensitive operations where interaction needs to be paused.
Name | Type | Optional | Description |
---|---|---|---|
display |
boolean |
Yes | Set to true to display the content blocker; false to hide it. |
handler |
function |
Yes | A callback function to invoke after the operation is completed. |
userContext |
object |
Yes | Additional context to pass to event listeners or the callback function. |
Returns the $fuse
object, enabling method chaining.
The OnBlocker event is triggered after the blocker is displayed or hidden.
Event Properties
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: Blocker . |
display |
boolean |
true if the content blocker is displayed; otherwise false . |
Example: Add Event Listener
function onBlocker(e) {
console.log('Blocker state changed:', e.display);
}
$fuse.addEvent('OnBlocker', onBlocker);
Example: Remove Event Listener
$fuse.removeEvent('OnBlocker', onBlocker);
Example: Remove All Event Listeners
$fuse.clearEvent('OnBlocker');
Show the content blocker
$fuse.blocker(true, () => {
console.log('Content blocker displayed.');
});
Hide the content blocker
$fuse.blocker(false, () => {
console.log('Content blocker hidden.');
});
This section provides tools for automating workflows and tasks within applications. These members allow developers to execute predefined actions, integrate with external processes, and streamline repetitive tasks.
These members enable developers to build efficient, automated solutions that reduce manual effort and improve productivity.
The execRPC method facilitates the execution of remote procedure calls (RPC) against a remote Fuse engine, enabling seamless interaction with external processes or services.
The execRPC
method is useful for communicating with remote components, executing specific methods, and handling the responses dynamically.
Syntax
$fuse.execRPC(request, handler, userContext);
Parameters
Name | Type | Optional | Description |
---|---|---|---|
request |
eTag.Fuse.RPCRequest |
No | An object containing details of the RPC to execute. |
handler |
function |
Yes | A callback function invoked upon completion of the operation. |
userContext |
object |
Yes | Additional information passed to event listeners or the callback function. |
Returns
Returns the $fuse
object, enabling method chaining.
RPCRequest Object
The eTag.Fuse.RPCRequest
object contains the following properties:
Property | Type | Optional | Description |
---|---|---|---|
requestId |
string |
Yes | The unique identifier for the request. |
targetRuntime |
object |
Yes | The identifier, SID, or name of the target runtime. |
targetComponent |
object |
Yes | The identifier, SID, or name of the target process, connector, or adapter. |
targetMethod |
string |
Yes | The name of the target method to invoke. |
expression |
object[] |
Yes | The expression to evaluate for the target method. |
options |
int |
Yes | Additional options for the request. |
commandOptions |
int |
Yes | Command-specific options. |
Example Usage
Execute a remote procedure call:
const rpcRequest = {
requestId: 'unique-request-id',
targetRuntime: { id: 'runtime-id' },
targetComponent: { id: 'component-id' },
targetMethod: 'methodName',
expression: [{ param1: 'value1' }],
options: 0,
commandOptions: 0
};
$fuse.execRPC(rpcRequest, function(response) {
if (response.status === 'success') {
console.log('RPC executed successfully:', response.result);
} else {
console.error('RPC execution failed:', response.status);
}
});
Events
The execRPC method triggers the following events:
OnMessage
: Raised after a message is processed.OnExecRPC
: Raised after the remote procedure call is executed.The OnExecRPC event provides the response from the RPC execution.
Event Properties
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: ExecRPC . |
response |
eTag.Fuse.RPCResponse |
The response from the remote procedure call. |
RPCResponse Object
The eTag.Fuse.RPCResponse
object contains the following properties:
Property | Type | Description |
---|---|---|
requestId |
string |
The unique identifier of the executed RPC request. |
result |
object |
The outcome of the remote procedure call. |
status |
string |
The response status, such as success or error . |
ResultUIPageId |
int |
The UI page identifier used to display the RPC result, if applicable. |
Example: Add an OnExecRPC Event Listener
function onExecRPC(e) {
if (e.response.status === 'success') {
console.log('RPC executed successfully:', e.response.result);
} else {
console.error('RPC execution failed:', e.response.status);
}
}
$fuse.addEvent('OnExecRPC', onExecRPC);
Example: Remove an Existing OnExecRPC Event Listener
$fuse.removeEvent('OnExecRPC', onExecRPC);
Example: Remove All OnExecRPC Event Listeners
$fuse.clearEvent('OnExecRPC');
Use Case
The execRPC method is particularly useful in scenarios requiring interaction with external services or processes, enabling applications to execute methods remotely and handle responses dynamically.
This section includes a collection of helper functions designed to simplify common programming tasks. These members provide quick solutions for string manipulation, type checking, and other everyday development needs.
These members enhance productivity by reducing the complexity of routine tasks.
The addEvent method allows you to attach a handler function to the specified event type, enabling the execution of custom logic when the event occurs. This method supports adding multiple event listeners and passing user context data to the handler.
The addEvent
method provides a straightforward way to extend the functionality of the Fuse Core by enabling developers to respond to specific events dynamically.
Parameters
Parameter | Type | Description |
---|---|---|
eventType |
string |
The type of event to add. |
handler |
function |
The function to execute when the event occurs. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Attach an event listener:
function afterCallout(e) {
console.log('done!'); // Outputs 'done!' to the Web Console.
}
$fuse.addEvent("OnCallout", afterCallout);
Attach an event listener with user context data:
function afterCallout(e) {
console.log(e.userContext); // Outputs 'my data' to the Web Console.
}
$fuse.addEvent("OnCallout", afterCallout, 'my data');
Add multiple event listeners consecutively:
$fuse
.addEvent("OnMessage", function (e) {
console.log(e.type); // Outputs the message type to the Web Console.
})
.addEvent("OnMinimize", function (e) {
console.log('minimized!'); // Outputs 'minimized!' to the Web Console.
})
.addEvent("OnMaximize", function (e) {
console.log('maximized!'); // Outputs 'maximized!' to the Web Console.
});
The attrb method allows you to get or set an attribute for a specified HTML element. When the value
parameter is omitted, the method retrieves the current attribute value. When the value
parameter is provided, the method sets the attribute and enables method chaining.
Parameters
Parameter | Type | Description |
---|---|---|
element |
object |
The HTML element whose attribute is being accessed or modified. |
name |
string |
The name of the attribute to get or set. |
value |
string |
(Optional) The value to assign to the specified attribute. |
Returns
value
is omitted, returns the attribute value of the specified element.value
is provided, returns the $fuse
object, enabling method chaining.Example Usage
Retrieve an attribute value:
const value = $fuse.attrb(document.getElementById('myElement'), 'class');
console.log(value); // Outputs the class attribute of the element to the Web Console.
Set an attribute value:
$fuse.attrb(document.getElementById('myElement'), 'class', 'new-class');
Set multiple attributes consecutively:
$fuse
.attrb(document.getElementById('myElement'), 'class', 'new-class')
.attrb(document.getElementById('myElement'), 'data-custom', 'customValue');
The bind method attaches an event handler to a specified DOM element, allowing developers to execute a callback function whenever the event is triggered.
Parameters
Parameter | Type | Description |
---|---|---|
target |
HTMLElement |
The DOM element to which the event handler will be attached. |
eventType |
string |
A string specifying the type of DOM event (e.g., "click" , "submit" , "keydown" ). |
handler |
function |
The callback function to execute whenever the specified event occurs. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Attach a handler to the keydown
event on the document:
function onKeydown(e) {
console.log('A key was pressed!');
}
$fuse.bind(document, 'keydown', onKeydown);
Attach multiple events consecutively:
$fuse
.bind(document, 'keydown', function (e) {
console.log('Keydown event detected!');
})
.bind(document, 'click', function (e) {
console.log('Click event detected!');
});
The clearEvent method removes all handlers attached to a specified event type. If no event type is provided, all handlers for all events are cleared.
Parameters
Parameter | Type | Description |
---|---|---|
eventType |
string |
(Optional) The type of event whose handlers should be cleared. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Clear all handlers for a specific event type:
$fuse.clearEvent("OnCallout");
Clear all handlers for all events:
$fuse.clearEvent();
The contains method checks whether a specific object or value is included in an array. It can optionally search for the object based on a specific attribute.
Parameters
Parameter | Type | Description |
---|---|---|
array |
object |
The array to search. |
find |
object |
The object or value to locate within the array. |
attribute |
object |
(Optional) The attribute used to identify the object in the array. |
Returns
Returns true
if the object or value is found in the array; otherwise, false
.
Example Usage
Check if an array contains a specific value:
const myArray = [1, 2, 3, 4];
const result = $fuse.contains(myArray, 3); // Returns true
console.log(result);
Check if an array contains an object by a specific attribute:
const myArray = [
{ id: 1, name: 'Alice' },
{ id: 2, name: 'Bob' },
];
const result = $fuse.contains(myArray, { id: 2 }, 'id'); // Returns true
console.log(result);
The convert method transforms a given value into the specified data type.
Parameters
Parameter | Type | Description |
---|---|---|
value |
object |
The value to be converted. |
type |
string |
(Optional) The target data type. Supported types: 'bool' , 'date' , 'float' , 'int' , 'string' . |
Returns
Returns the converted value in the specified data type.
Example Usage
Convert a string to an integer:
const result = $fuse.convert("123", "int"); // Returns 123 as an integer
console.log(result);
Convert a string to a boolean:
const result = $fuse.convert("true", "bool"); // Returns true as a boolean
console.log(result);
Convert a date string to a Date
object:
const result = $fuse.convert("2024-01-01", "date"); // Returns a Date object
console.log(result);
The createDelegate method generates a delegate function that maintains the initial context and arguments specified during its creation.
Parameters
Parameter | Type | Description |
---|---|---|
instance |
object |
The object instance to be used as the context for the delegate function. |
handler |
function |
The function from which the delegate is created. |
arguments |
object |
(Optional) An array of additional values to be passed when the delegate is invoked. |
Returns
Returns a delegate function.
Example Usage
Create a delegate function for a method:
const obj = {
name: "Example",
showName: function () {
console.log(this.name);
}
};
const delegate = $fuse.createDelegate(obj, obj.showName);
delegate(); // Outputs: "Example"
Create a delegate function with additional arguments:
function greet(greeting, name) {
console.log(greeting + ", " + name + "!");
}
const delegate = $fuse.createDelegate(null, greet, ["Hello", "John"]);
delegate(); // Outputs: "Hello, John!"
The decodeURI method decodes a Uniform Resource Identifier (URI) previously encoded using encodeURI
or a similar method, returning its original readable format.
Parameters
Parameter | Type | Description |
---|---|---|
uri |
string |
The encoded Uniform Resource Identifier (URI). |
Returns
Returns a string representing the decoded version of the provided URI.
Example Usage
Decode an encoded URI:
const encodedURI = "https%3A%2F%2Fwww.example.com%2Fpath%3Fquery%3Dvalue";
const decodedURI = $fuse.decodeURI(encodedURI);
console.log(decodedURI); // Outputs: "https://www.example.com/path?query=value"
The generateGuid method generates and returns a globally unique identifier (GUID), ensuring a unique value for use in applications.
Parameters
None.
Returns
Returns a string representing the globally unique identifier.
Example Usage
Generate a GUID:
const guid = $fuse.generateGuid();
console.log(guid); // Outputs a GUID, e.g., "3f2504e0-4f89-11d3-9a0c-0305e82c3301"
The getBaseUrl method returns the base URL for the specified document URL.
Parameters
Name | Type | Description |
---|---|---|
url | string | The URL to extract the base URL from. |
Returns
Returns a string representing the base URL of the specified document.
Example Usage
Retrieve the base URL of a document:
const baseUrl = $fuse.getBaseUrl("https://example.com/path/to/page");
console.log(baseUrl); // Outputs "https://example.com/"
The getDomain method extracts and returns the domain of the specified URL.
Parameters
Name | Type | Description |
---|---|---|
url | string | The URL to extract the domain from. |
Returns
Returns a string representing the domain of the specified URL.
Example Usage
Retrieve the domain of a URL:
const domain = $fuse.getDomain("https://example.com/path/to/page");
console.log(domain); // Outputs "example.com"
The getHostname method retrieves the hostname from the specified URL.
Parameters
Name | Type | Description |
---|---|---|
url | string | The URL to extract the hostname from. |
Returns
Returns a string representing the hostname of the specified URL.
Example Usage
Retrieve the hostname of a URL:
const hostname = $fuse.getHostname("https://example.com/path/to/page");
console.log(hostname); // Outputs "example.com"
The getPageUrl method retrieves the URL of the current page.
Parameters
None.
Returns
Returns a string representing the URL of the current page.
Example Usage
Retrieve the URL of the current page:
const pageUrl = $fuse.getPageUrl();
console.log(pageUrl); // Outputs the current page URL
The hasClass method determines whether a specified HTML element has been assigned a particular class.
Parameters
Name | Type | Description |
---|---|---|
target |
HTMLElement |
The element to check. |
className |
string |
The class name to search for on the element. |
Returns
Returns true
if the specified class is assigned to the element; otherwise, false
.
Example Usage
Check if an element has a specific class:
const element = document.getElementById('example');
const result = $fuse.hasClass(element, 'active');
console.log(result); // Outputs true if 'active' class is assigned to the element
The isArray method determines whether the specified value is an array.
Parameters
Name | Type | Description |
---|---|---|
value |
object |
The value to check. |
Returns
Returns true
if the specified value is an array; otherwise, false
.
Example Usage
Check if a value is an array:
const value = [1, 2, 3];
const result = $fuse.isArray(value);
console.log(result); // Outputs true
Check a non-array value:
const value = 'Hello, World!';
const result = $fuse.isArray(value);
console.log(result); // Outputs false
The isDefined method checks whether the specified value is defined.
Parameters
Name | Type | Description |
---|---|---|
value |
object |
The value to check. |
Returns
Returns true
if the specified value is defined; otherwise, false
.
Example Usage
Check if a value is defined:
const value = 42;
const result = $fuse.isDefined(value);
console.log(result); // Outputs true
Check an undefined value:
let value;
const result = $fuse.isDefined(value);
console.log(result); // Outputs false
The isFunction method checks whether the specified value is a JavaScript function.
Parameters
Name | Type | Description |
---|---|---|
value |
object |
The value to check. |
Returns
Returns true
if the specified value is a JavaScript function; otherwise, false
.
Example Usage
Check if a value is a function:
const value = function() { return "Hello, World!"; };
const result = $fuse.isFunction(value);
console.log(result); // Outputs true
Check if a value is not a function:
const value = 42;
const result = $fuse.isFunction(value);
console.log(result); // Outputs false
The isNumber method checks whether the specified value is a number.
Parameters
Name | Type | Description |
---|---|---|
value |
object |
The value to check. |
Returns
Returns true
if the specified value is a number; otherwise, false
.
Example Usage
Check if a value is a number:
const value = 123;
const result = $fuse.isNumber(value);
console.log(result); // Outputs true
Check if a value is not a number:
const value = "Hello, World!";
const result = $fuse.isNumber(value);
console.log(result); // Outputs false
The isObject method determines whether the specified value is a JavaScript object.
Parameters
Name | Type | Description |
---|---|---|
value |
object |
The value to check. |
Returns
Returns true
if the specified value is a JavaScript object; otherwise, false
.
Example Usage
Check if a value is an object:
const value = { key: "value" };
const result = $fuse.isObject(value);
console.log(result); // Outputs true
Check if a value is not an object:
const value = "Hello, World!";
const result = $fuse.isObject(value);
console.log(result); // Outputs false
The isString method determines whether the specified value is a string.
Parameters
Name | Type | Description |
---|---|---|
value |
object |
The value to check. |
Returns
Returns true
if the specified value is a string; otherwise, false
.
Example Usage
Check if a value is a string:
const value = "Hello, World!";
const result = $fuse.isString(value);
console.log(result); // Outputs true
Check if a value is not a string:
const value = 12345;
const result = $fuse.isString(value);
console.log(result); // Outputs false
The isUrl method determines whether the specified value is a valid URL.
Parameters
Name | Type | Description |
---|---|---|
value |
object |
The value to check. |
Returns
Returns true
if the specified value is a valid URL; otherwise, false
.
Example Usage
Check if a value is a valid URL:
const value = "https://example.com";
const result = $fuse.isUrl(value);
console.log(result); // Outputs true
Check if a value is not a valid URL:
const value = "not_a_url";
const result = $fuse.isUrl(value);
console.log(result); // Outputs false
The isUrlAbsolute method checks whether the specified URL is an absolute URL.
Parameters
Name | Type | Description |
---|---|---|
url |
object |
The string containing a URL. |
Returns
Returns true
if the specified URL is absolute; otherwise, false
.
Example Usage
Check if a URL is absolute:
const url = "https://example.com/page";
const result = $fuse.isUrlAbsolute(url);
console.log(result); // Outputs true
Check if a URL is not absolute:
const url = "/relative/path";
const result = $fuse.isUrlAbsolute(url);
console.log(result); // Outputs false
The merge method combines two or more arrays into a single array, preserving the order of elements.
Parameters
Name | Type | Description |
---|---|---|
message |
object |
The message arguments. |
Returns
Returns an array containing the merged items from the input arrays.
Example Usage
Merge two arrays:
const array1 = [1, 2, 3];
const array2 = [4, 5, 6];
const mergedArray = $fuse.merge(array1, array2);
console.log(mergedArray); // Outputs [1, 2, 3, 4, 5, 6]
Merge multiple arrays:
const array1 = [1, 2];
const array2 = [3, 4];
const array3 = [5, 6];
const mergedArray = $fuse.merge(array1, array2, array3);
console.log(mergedArray); // Outputs [1, 2, 3, 4, 5, 6]
The parseExpression method parses a declarative expression and returns an object representation of it, optionally incorporating provided arguments.
Parameters
Name | Type | Description |
---|---|---|
expression |
string |
The value of the declarative expression to parse. |
arguments |
array |
(Optional) The arguments to pass into the declarative expression. |
Returns
Returns an object containing the parsed representation of the expression.
Example Usage
Parse a simple expression:
const expression = "a + b";
const parsed = $fuse.parseExpression(expression, [5, 10]);
console.log(parsed);
// Outputs an object representing the parsed expression.
Parse an expression with function arguments:
const expression = "add(x, y)";
const args = [2, 3];
const parsed = $fuse.parseExpression(expression, args);
console.log(parsed);
// Outputs an object representing the parsed function call.
The raiseEvent method manually invokes all event listeners attached to a specified event type. It is primarily used for simulating the receipt of a Fuse response that triggers event listeners.
Note: This method is rarely used directly and is typically applied in scenarios requiring event simulation.
Parameters
Name | Type | Description |
---|---|---|
eventType |
string |
The type of event to invoke. |
arguments |
object |
(Optional) Additional arguments to pass along to handlers. |
handler |
object |
(Optional) An additional handler to invoke. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Manually raise an event:
$fuse.raiseEvent("OnMessage", { message: "Test message" });
Raise an event with additional arguments and a custom handler:
$fuse.raiseEvent("OnError", { error: "Simulated error" }, function(e) {
console.log("Custom handler invoked:", e);
});
Event Listeners
This method can invoke event listeners for built-in events such as:
Example: Add Event Listener
function onMessage(e) {
console.log("Message received:", e.message);
}
$fuse.addEvent("OnMessage", onMessage);
Example: Add Event Listener
function onError(e) {
console.error("Error received:", e.message);
}
$fuse.addEvent("OnError", onError);
The remove method removes the first occurrence of a specified entry in an array.
Parameters
Name | Type | Description |
---|---|---|
array |
object |
The array to search. |
find |
object |
The object or value to remove from the array. |
attribute |
object |
(Optional) The attribute of the object used to locate the value. |
Returns
Returns true
if the removal was successful; otherwise, false
.
Example Usage
Remove a value from an array:
let myArray = [1, 2, 3, 4];
$fuse.remove(myArray, 3); // Removes the value '3' from the array.
console.log(myArray); // Outputs: [1, 2, 4]
Remove an object based on an attribute:
let myArray = [
{ id: 1, name: "Alice" },
{ id: 2, name: "Bob" },
{ id: 3, name: "Charlie" }
];
$fuse.remove(myArray, { id: 2 }, "id"); // Removes the object with id: 2.
console.log(myArray);
// Outputs: [{ id: 1, name: "Alice" }, { id: 3, name: "Charlie" }]
The removeEvent method removes a specific handler from the list of event listeners for a given event type.
Parameters
Name | Type | Description |
---|---|---|
eventType |
string |
The type of event for which to remove the handler. |
handler |
function |
The event handler to remove. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Remove a specific event listener:
function myEventHandler(e) {
console.log("Event triggered!");
}
// Add an event listener
$fuse.addEvent("OnCustomEvent", myEventHandler);
// Remove the event listener
$fuse.removeEvent("OnCustomEvent", myEventHandler);
The unbind method detaches a specific handler or all handlers from a specified event on a target element.
Parameters
Name | Type | Description |
---|---|---|
target |
HTMLElement |
The element from which to detach the handler. |
evenType |
string |
A string containing the DOM event type (e.g., "click", "submit"). |
handler |
function |
(Optional) The specific handler to detach. If omitted, all handlers for the event type will be removed. |
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Detach a specific handler from an event:
function onKeydown(e) {
console.log("Key pressed!");
}
// Add a handler to the document keydown event
$fuse.bind(document, 'keydown', onKeydown);
// Detach the handler
$fuse.unbind(document, 'keydown', onKeydown);
Detach all handlers for a specific event:
$fuse.unbind(document, 'keydown');
Detach all handlers from an element:
$fuse.unbind(document);
The uniqueId method generates a unique alphanumeric random identifier with a length that is a multiple of 4 characters.
Parameters
Name | Type | Description |
---|---|---|
multiple |
number |
(Optional) A number determining the length of the generated ID. Default: 2. |
Returns
Returns a string
containing the unique alphanumeric random identifier.
Example Usage
Generate a unique alphanumeric random identifier with default length:
console.log($fuse.uniqueId()); // Outputs '69989b22' (8 characters).
Generate a unique identifier with a custom length:
console.log($fuse.uniqueId(1)); // Outputs '0f4a' (4 characters).
console.log($fuse.uniqueId(4)); // Outputs '163c182884c2c90b' (16 characters).
This section provides members for managing permissions, privileges, and secure operations within applications. These members enable developers to enforce access controls and monitor user actions.
These members ensure that applications remain secure and compliant with organizational policies.
The hasPermission method checks whether the current user has the specified permission(s). It allows developers to validate user access to specific functionalities or resources based on assigned permissions.
permissions (number)
A number containing the individual permission bit flags to test.
any (boolean)
(optional)
Set to true
to validate whether the user is assigned any of the specified permissions. Defaults to false
, which validates that the user has all specified permissions.
(boolean)
true
if the user has the specified permission(s); otherwise, false
.Check if a user has specific permissions:
const hasAccess = $fuse.hasPermission(32);
console.log(hasAccess); // Outputs true or false based on user permissions.
Validate if a user has any of the specified permissions:
const hasAnyPermission = $fuse.hasPermission(48, true);
console.log(hasAnyPermission); // Outputs true if any of the permissions match.
The hasPrivilege method checks whether the current user has the specified privilege within a permission set. This method enables fine-grained access control by validating user privileges tied to a specific system identifier.
permissionSetSID (string)
The system identifier of the permission set to check.
permissions (number)
(optional)
A number containing the individual permission bit flags to test. If omitted, the method checks whether the user is assigned any permission from the set.
any (boolean)
(optional)
Set to true
to validate whether the user is assigned any of the specified permissions. Defaults to false
, which checks that the user has all specified permissions.
(boolean)
true
if the user has the specified privilege; otherwise, false
.Check if a user has a specific privilege:
const hasUserPrivilege = $fuse.hasPrivilege('eTag.Fuse.User', 512);
console.log(hasUserPrivilege); // Outputs true or false based on user privileges.
Validate if a user has any privilege from a set:
const hasAnyPrivilege = $fuse.hasPrivilege('eTag.Fuse.Admin', undefined, true);
console.log(hasAnyPrivilege); // Outputs true if the user has any privilege in the set.
The showAccessBanners method displays access banners for a specified entity instance. These banners provide relevant information or notifications based on the entity and instance details.
args (eTag.Fuse.AccessBannerArgs)
An object containing the following properties:
(string)
(int)
handler (function)
(optional)
A callback function to invoke after the operation is completed.
userContext (object)
(optional)
Additional information to pass to event listeners or the callback function.
(eTag.Fuse.Core)
$fuse
object, enabling method chaining.OnMessage
Triggered when a message related to the operation is processed.
OnShowAccessBanners
Triggered when the access banners are displayed.
Display access banners for a specific entity instance:
$fuse.showAccessBanners({
entitySID: 'eTag.Fuse.UIFeedbackType',
instanceId: 12
});
function onShowAccessBanners(e) {
console.log('Access banners displayed for:', e.entitySID, 'Instance ID:', e.instanceId);
}
$fuse.addEvent("OnShowAccessBanners", onShowAccessBanners);
The fullName property retrieves the full name of the current user.
Data Type
string
Version
Usage
This property is used to obtain the full name of the logged-in user, which can be useful for display purposes or personalized user interfaces.
Example Usage
Retrieve Full Name:
console.log("User Full Name:", $fuse.fullName);
Display User's Full Name:
document.getElementById("welcomeMessage").innerText = `Welcome, ${$fuse.fullName}!`;
The groups property provides access to the security groups associated with the current user. These groups can be used to manage access controls and permissions within the application.
Data Type
array
Version
Usage
This property is typically used to query or manage security groups assigned to the user for controlling access to application features or resources.
Example Usage
Log All Groups:
console.log("User Security Groups:", $fuse.groups);
The permissions property provides access to the current user's permissions or allows setting new permissions. Permissions define specific actions the user is allowed to perform within the application.
Data Type
array
Version
Usage
This property is used to retrieve or assign permissions to the user, supporting permission-based access control.
Example Usage
Retrieve User Permissions:
console.log("User Permissions:", $fuse.permissions);
The privileges property provides access to the privileges associated with the current user. Privileges define specific rights or permissions granted to the user.
Data Type
array
Version
Usage
This property allows developers to check the privileges assigned to the user, enabling privilege-based access control within the application.
Example Usage
Log All Privileges:
console.log("User Privileges:", $fuse.privileges);
The roles property provides access to the security roles associated with the current user. Roles are typically used to determine a user's level of access or permissions within the application.
Data Type
array
Version
Usage
This property allows developers to query or verify the roles assigned to the user, enabling role-based access control within the application.
Example Usage
Log All Roles:
console.log("User Security Roles:", $fuse.roles);
The userId property retrieves the identifier of the currently active user.
Data Type
number
Version
Usage
This property is used to obtain the unique identifier of the active user, which can be utilized for authentication, user-specific operations, or audit trails.
Example Usage
Retrieve User ID:
console.log("Active User ID:", $fuse.userId);
Check User Access Based on ID:
if ($fuse.userId === 12345) {
console.log("Admin user detected.");
}
The userName property retrieves the name of the currently active user.
Data Type
string
Version
Usage
This property is used to access the active user's name for display, logging, or user-specific operations.
Example Usage
Retrieve User Name:
console.log("Active User Name:", $fuse.userName);
Display User Greeting:
console.log("Welcome, " + $fuse.userName + "!");
This section focuses on members for creating and managing user notifications. These tools enable developers to send alerts, messages, and other notifications to keep users informed.
These members ensure effective communication with users through notifications.
The callout method displays a callout message to the user for a specified duration. It is a versatile tool for providing real-time notifications or messages within your application.
The callout
method is particularly useful for brief, non-intrusive notifications that automatically dismiss after a set period or require no user interaction.
Parameters
string
): The message text to display.int
, optional): The duration in milliseconds before the message is dismissed. Defaults to 5000
if omitted.function
, optional): A callback function invoked after the callout operation completes.object
, optional): Additional information passed to event listeners or the callback function.Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Display a callout message for 5 seconds:
$fuse.callout('Hello World!', 5000);
Display a callout message with a callback and user context:
function afterCallout(e) {
console.log(e.userContext); // Outputs 'done!' to the Web Console.
}
$fuse.callout('Hello World!', 5000, afterCallout, 'done!');
Events
string
): The message type. Value: Callout
.object
): An object indicating the callout result. Value is 'OK'
if successful, otherwise contains an error message.Event Example: Add Event Listener
function onCallout(e) {
console.log('Callout message displayed!');
}
$fuse.addEvent('OnCallout', onCallout);
Event Example: Remove Event Listener
$fuse.removeEvent('OnCallout', onCallout);
Event Example: Clear All Listeners
$fuse.clearEvent('OnCallout');
The showMessage method displays a message dialog with customizable settings. It supports rich configurations, including multiple buttons, input fields, and styles, enabling interactive and user-friendly prompts.
Parameters
settings (eTag.Fuse.MessageSettingsArgs
| string
):
The message settings or prompt to display. Can be either a string for a simple message or a detailed settings object for advanced dialogs.
string
): Additional information to pass to event listeners or the callback function.string
): The message prompt to display.string
, optional): The dialog title.string
, optional): Buttons to display (e.g., 'yes|no'
, 'accept|decline'
). Available buttons: accept
, decline
, cancel
, abort
, retry
, ignore
, no
, yes
, and OK
.array.<eTag.Fuse.MessageSettingField>
, optional): Array of input fields for user data collection.int
, optional): The dialog's width.int
, optional): The dialog's height.handler (function
, optional): A callback function to invoke after the message dialog is closed.
userContext (object
, optional): Additional context data passed to the callback function or event listeners.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Display a simple message:
$fuse.showMessage('Hello World!');
Display a message with advanced settings:
$fuse.showMessage(
{
"prompt": "Are you sure you want to delete this record?",
"title": "Delete?",
"buttons": "yes|no"
},
function (e) {
console.log(e.button + ' pressed!'); // Outputs the button pressed to the Web Console.
}
);
Events
OnMessage
string
): The message type.object
): The message details.OnMessageButtonClick
string
): The message type. Value: MessageButtonClick
.string
): The button clicked by the user.Event Example: Add Event Listener
function onMessageButtonClick(e) {
console.log('Button pressed: ' + e.button);
}
$fuse.addEvent('OnMessageButtonClick', onMessageButtonClick);
Event Example: Remove Event Listener
$fuse.removeEvent('OnMessageButtonClick', onMessageButtonClick);
Event Example: Clear All Listeners
$fuse.clearEvent('OnMessageButtonClick');
The sendNotification method sends a notification with customizable attributes such as priority, type, subject, and additional data. Notifications can be tailored to various scenarios like system alerts, reminders, or feedback requests.
Parameters
args (eTag.Fuse.NotificationArgs
):
The notification settings.
string
| number
, optional): The notification priority. Acceptable values:
0
(Low
), 1
(Medium
), 2
(High
), 3
(Urgent
).string
, optional): The type of notification. Available types:
system
, info
, alert
, reminder
, decision
, feedback
.string
, optional): The notification subject.string
, optional): The notification body message.string
, optional): Additional data to include with the notification.string
, optional): A reference number for the notification.handler (function
, optional): A callback function to invoke after the notification is sent.
userContext (object
, optional): Additional context data passed to the callback function or event listeners.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Send a simple notification:
$fuse.sendNotification({
priority: 1,
notificationType: 'info',
subject: 'System Update',
body: 'The system will undergo maintenance tonight from 10 PM to 2 AM.'
});
Send a notification with a callback and user context:
function onNotificationSent(e) {
console.log('Notification sent with reference: ' + e.userContext.referenceNo);
}
$fuse.sendNotification(
{
priority: 2,
notificationType: 'alert',
subject: 'High Disk Usage',
body: 'Disk usage on server X has exceeded 90%.',
referenceNo: '12345'
},
onNotificationSent,
{ referenceNo: '12345' }
);
Events
OnMessage
string
): The message type.object
): The message details.OnSendNotification
string
): The message type. Value: SendNotification
.object
): The response of the notification operation.Event Example: Add Event Listener
function onSendNotification(e) {
console.log('Notification sent successfully.');
}
$fuse.addEvent('OnSendNotification', onSendNotification);
Event Example: Remove Event Listener
$fuse.removeEvent('OnSendNotification', onSendNotification);
Event Example: Clear All Listeners
$fuse.clearEvent('OnSendNotification');
This section includes members for tracking and recording application events or user actions. These tools provide a way to log data for debugging, analytics, or compliance purposes.
These members ensure that application activity is transparent and traceable.
The saveEvent method saves a specified event into the Fuse data store. This method allows structured logging and tracking of events such as errors, warnings, or informational messages.
Parameters
event (eTag.Fuse.Event
):
The event details to save.
string
): The base type of the event. Valid values:
error
, information
, warning
, debug
.int
, optional): The event number.string
, optional): A descriptive message for the event.string
, optional): A code associated with the event.string
, optional): Custom fields for additional event data.handler (function
, optional): A callback function to invoke after the event is saved.
userContext (object
, optional): Additional context data passed to the callback function or event listeners.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Save an informational event:
$fuse.saveEvent({
baseType: 'information',
number: 101,
message: 'User logged in successfully.',
user1: '[email protected]'
});
Save an error event with a callback:
function afterSaveEvent(e) {
console.log('Event saved successfully.');
}
$fuse.saveEvent(
{
baseType: 'error',
number: 500,
message: 'Database connection failed.',
code: 'DB_CONN_ERR',
user1: 'Server: DB01'
},
afterSaveEvent
);
Events
OnMessage
string
): The message type.object
): The message details.OnSaveEvent
string
): The message type. Value: SaveEvent
.object
): The response of the save operation.Event Example: Add Event Listener
function onSaveEvent(e) {
console.log('Event saved: ' + e.message);
}
$fuse.addEvent('OnSaveEvent', onSaveEvent);
Event Example: Remove Event Listener
$fuse.removeEvent('OnSaveEvent', onSaveEvent);
Event Example: Clear All Listeners
$fuse.clearEvent('OnSaveEvent');
This section provides members for tracking and managing user interactions and application activities. These tools allow developers to monitor workflows, log key events, and enhance user engagement through activity-based updates.
These members enable developers to create more interactive and user-focused applications by leveraging activity insights.
The applyUserActivity method notifies Fuse of user activity. This helps maintain and track user interactions within the application for activity logging, session management, or analytics purposes.
Parameters
handler (function
, optional):
A callback function to invoke after the operation is completed.
userContext (object
, optional):
Additional context data passed to the callback function or event listeners.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Notify Fuse of user activity:
$fuse.applyUserActivity();
Notify Fuse with a callback:
function onUserActivityNotified(e) {
console.log('User activity logged successfully.');
}
$fuse.applyUserActivity(onUserActivityNotified);
Events
OnMessage
string
): The message type.object
): The message details.OnApplyUserActivity
string
): The message type. Value: ApplyUserActivity
.object
): The response of the user activity notification.Event Example: Add Event Listener
function onApplyUserActivity(e) {
console.log('User activity applied: ' + e.response);
}
$fuse.addEvent('OnApplyUserActivity', onApplyUserActivity);
Event Example: Remove Event Listener
$fuse.removeEvent('OnApplyUserActivity', onApplyUserActivity);
Event Example: Clear All Listeners
$fuse.clearEvent('OnApplyUserActivity');
The saveHistory method saves a history item within the Fuse environment. This allows tracking and managing user navigation or activity history for future reference.
Parameters
args (SaveHistoryArgs
):
The arguments required to save a history item.
string
, optional): The page system identifier.string
, optional): The title text for the history item.string
, optional): The content URL associated with the history item.handler (function
, optional):
A callback function to invoke after the operation is completed.
userContext (object
, optional):
Additional context data passed to the callback function or event listeners.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Save a history item:
$fuse.saveHistory({
pageSID: 'examplePageSID',
title: 'Example Page',
contentUrl: 'https://example.com/content'
});
Save a history item with a callback:
function onHistorySaved(e) {
console.log('History saved successfully: ', e.response);
}
$fuse.saveHistory({
pageSID: 'examplePageSID',
title: 'Example Page',
contentUrl: 'https://example.com/content'
}, onHistorySaved);
Events
OnMessage
string
): The message type.object
): The message details.OnSaveEvent
string
): The message type. Value: SaveEvent
.object
): The response of the history save operation.Event Example: Add Event Listener
function onSaveEvent(e) {
console.log('History save event received: ' + e.response);
}
$fuse.addEvent('OnSaveEvent', onSaveEvent);
Event Example: Remove Event Listener
$fuse.removeEvent('OnSaveEvent', onSaveEvent);
Event Example: Clear All Listeners
$fuse.clearEvent('OnSaveEvent');
This section provides members for managing and interacting with application content dynamically. These tools allow developers to update text, save changes, and handle user input programmatically.
These members enhance the flexibility and responsiveness of application content management.
The editText method allows editing text content dynamically in the Fuse environment. It supports customization options such as text format, toolbar settings, and themes to provide a rich text editing experience.
Parameters
eTag.Fuse.EditTextArgs | string
):EditTextArgs Properties
text (string
, optional):
The initial text to edit.
format (string
, optional):
The text format. Available options: 'text'
or 'html'
.
title (string
, optional):
The title for the editing window.
theme (string
, optional):
The theme for the editor. Available options: 'bubble'
or 'snow'
(default: 'snow'
).
placeholder (string
, optional):
Placeholder text for the editor.
toolbar (array
, optional):
Toolbar options for the editor.
editorSID (array
, optional):
The system identifier for the editor.
context (string
, optional):
Additional contextual information during broadcast.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Edit simple HTML text:
$fuse.editText("<p>hello world</p>");
Edit text with settings:
$fuse.editText({
text: "Initial content",
format: "html",
title: "Edit Content",
theme: "bubble",
placeholder: "Type your content here...",
toolbar: ["bold", "italic", "underline"]
});
Events
string
): The message type. Value: EditText
.object
): The result of the text editing operation.Event Example: Add Event Listener
function onEditText(e) {
console.log('EditText event received: ', e.response);
}
$fuse.addEvent('OnEditText', onEditText);
Event Example: Remove Event Listener
$fuse.removeEvent('OnEditText', onEditText);
Event Example: Clear All Listeners
$fuse.clearEvent('OnEditText');
The saveComment method allows you to add a comment to Fuse, associating it with a specific thread or entity.
Parameters
comment (eTag.Fuse.Comment
):
A configuration object that represents the comment details.
handler (function
, optional):
A callback function to invoke after the operation is completed.
userContext (object
, optional):
Additional context information passed to event listeners or the callback function.
Comment Properties
commentId (int
, optional):
The identifier for the comment.
threadId (int
, optional):
The identifier for the comment's thread.
entity (object
, optional):
The entity's system or numeric identifier to associate with the comment.
contents (string
):
The content of the comment message.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Save a comment to a specific thread:
$fuse.saveComment({
commentId: 1,
threadId: 100,
entity: { systemId: "entity123" },
contents: "This is a comment."
});
Save a comment with a callback function:
$fuse.saveComment(
{
threadId: 200,
contents: "Another comment example."
},
function (response) {
console.log("Comment saved:", response);
}
);
Events
string
): The message type. Value: SaveComment
.object
): The result of the save operation.Event Example: Add Event Listener
function onSaveComment(e) {
console.log('SaveComment event received: ', e.response);
}
$fuse.addEvent('OnSaveComment', onSaveComment);
Event Example: Remove Event Listener
$fuse.removeEvent('OnSaveComment', onSaveComment);
Event Example: Clear All Listeners
$fuse.clearEvent('OnSaveComment');
This section includes members for managing application state and monitoring changes dynamically. These tools enable developers to create responsive and interactive workflows.
These members ensure a seamless and adaptive application experience.
The observeVar method registers a variable observer, triggering the OnObserve event listener when the specified variable changes. This method enables real-time monitoring and interaction with variables in different scopes.
Parameters
name (string | string[]
):
The name of the variable or a list of variables to observe. Use '*'
to observe all variables within the specified scope.
scope (string
, optional):
The scope of the variable. The default is 'page'
.
'page'
: Accessible only by instances of a given page.'app'
: Accessible by pages belonging to the same application.'global'
: Accessible by all running pages.handler (function
, optional):
A callback function to execute after a variable observer is registered.
userContext (object
, optional):
Additional context information passed to event listeners or the callback function.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Observe a single variable in the page
scope:
$fuse.observeVar('myVariable', 'page');
Observe multiple variables in the app
scope with a callback:
$fuse.observeVar(['var1', 'var2'], 'app', function () {
console.log('Observer registered for var1 and var2');
});
Observe all variables in the global
scope:
$fuse.observeVar('*', 'global');
Events
OnObserveVar
string
): The message type. Value: ObserveVar
.object
): The response after registering the observer.OnObserve
string
): The message type. Value: Observe
.string
): The name of the observed variable.object
): The new value of the observed variable.Event Example: Add Listener for OnObserve
function onVariableChange(e) {
console.log('Variable changed:', e.variable, 'New value:', e.value);
}
$fuse.addEvent('OnObserve', onVariableChange);
Event Example: Add Listener for OnObserveVar
function onObserverRegistered(e) {
console.log('Observer registered for:', e.response);
}
$fuse.addEvent('OnObserveVar', onObserverRegistered);
Event Example: Remove Listeners
Remove a specific listener:
$fuse.removeEvent('OnObserve', onVariableChange);
Remove all listeners for an event:
$fuse.clearEvent('OnObserveVar');
The unobserveVar method unregisters a variable observer, stopping notifications for changes to the specified variable(s).
Parameters
name (string | string[]
):
The name of the variable or a list of variables to stop observing. Use '*'
to stop observing all variables within the specified scope.
scope (string
, optional):
The scope of the variable. The default is 'page'
.
'page'
: Accessible only by instances of a given page.'app'
: Accessible by pages belonging to the same application.'global'
: Accessible by all running pages.handler (function
, optional):
A callback function to execute after the observer is unregistered.
userContext (object
, optional):
Additional context information passed to event listeners or the callback function.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Unobserve a single variable in the page
scope:
$fuse.unobserveVar('myVariable', 'page');
Unobserve multiple variables in the app
scope with a callback:
$fuse.unobserveVar(['var1', 'var2'], 'app', function () {
console.log('Stopped observing var1 and var2');
});
Unobserve all variables in the global
scope:
$fuse.unobserveVar('*', 'global');
Events
string
): The message type. Value: UnobserveVar
.object
): The response after unregistering the observer.Event Example: Add Listener for OnUnobserveVar
function onVariableUnobserve(e) {
console.log('Stopped observing variable:', e.response);
}
$fuse.addEvent('OnUnobserveVar', onVariableUnobserve);
Event Example: Remove Listeners
Remove a specific listener:
$fuse.removeEvent('OnUnobserveVar', onVariableUnobserve);
Remove all listeners for an event:
$fuse.clearEvent('OnUnobserveVar');
The var method gets or sets a variable within the specified scope. This method allows for variable management at different levels, such as page
, app
, or global
.
Parameters
name (string
):
The name of the variable.
value (object
):
The value to set for the variable. If omitted, the method returns the current value of the variable.
scope (string
, optional):
The scope of the variable. The default is 'page'
.
'page'
: Accessible only by instances of a given page.'app'
: Accessible by pages belonging to the same application.'global'
: Accessible by all running pages.persist (boolean
, optional):
Set to true
to persist the variable in the Fuse data store; otherwise, false
.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Set a variable in the page
scope:
$fuse.var('myVariable', 'value', 'page');
Get the value of a variable:
const value = $fuse.var('myVariable');
console.log(value);
Set a global variable and persist it:
$fuse.var('globalVar', 42, 'global', true);
Events
string
): The message type.string
): The name of the variable.object
): The new value of the variable.object
): The old value of the variable.boolean
): true
if the variable is persisted; otherwise, false
.Event Example: Add Listener for OnVariableChange
function onVariableChange(e) {
console.log(`Variable ${e.name} changed from ${e.old} to ${e.value}`);
}
$fuse.addEvent('OnVariableChange', onVariableChange);
Event Example: Remove Listeners
Remove a specific listener:
$fuse.removeEvent('OnVariableChange', onVariableChange);
Remove all listeners for an event:
$fuse.clearEvent('OnVariableChange');
This section provides members for executing and managing interpreted commands or scripts. These tools allow developers to evaluate expressions and execute commands programmatically.
These members extend application functionality by enabling flexible command execution.
The iniInterpreter method initializes the interpreter within the eTag Fuse Core framework. This method sets up the necessary environment for interpreting expressions or commands.
Parameters
None.
Returns
Returns the $fuse
object, enabling method chaining.
Example Usage
Initialize the interpreter:
$fuse.iniInterpreter();
The startInterpreter method begins the operation of the interpreter in the eTag Fuse Core framework. This method activates the interpreter, enabling it to process commands or expressions.
Parameters
handler (optional):
A callback function to invoke after the operation is completed.
userContext (optional):
Additional information to pass to event listeners or the callback function.
Returns
Returns the $fuse
object, enabling method chaining.
Events
type
: The message type, set to StartInterpreter
.response
: A message indicating the interpreter's status (OK
for success or an error message).Example Usage
Start the interpreter:
$fuse.startInterpreter();
Example: Add Event Listener
Add a listener for the OnStartInterpreter
event:
function onStartInterpreter(e) {
console.log('Interpreter started:', e.response);
}
$fuse.addEvent('OnStartInterpreter', onStartInterpreter);
Example: Remove Event Listener
Remove a specific listener:
$fuse.removeEvent('OnStartInterpreter', onStartInterpreter);
Remove all listeners for the event:
$fuse.clearEvent('OnStartInterpreter');
The stopInterpreter method halts the operation of the interpreter in the eTag Fuse Core framework. This method stops the interpreter, preventing it from processing further commands or expressions.
Parameters
handler (optional):
A callback function to invoke after the operation is completed.
userContext (optional):
Additional information to pass to event listeners or the callback function.
Returns
Returns the $fuse
object, enabling method chaining.
Events
type
: The message type, set to StopInterpreter
.response
: A message indicating the interpreter's status (OK
for success or an error message).Example Usage
Stop the interpreter:
$fuse.stopInterpreter();
Example: Add Event Listener
Add a listener for the OnStopInterpreter
event:
function onStopInterpreter(e) {
console.log('Interpreter stopped:', e.response);
}
$fuse.addEvent('OnStopInterpreter', onStopInterpreter);
Example: Remove Event Listener
Remove a specific listener:
$fuse.removeEvent('OnStopInterpreter', onStopInterpreter);
Remove all listeners for the event:
$fuse.clearEvent('OnStopInterpreter');
This section includes members for providing user assistance and collecting feedback. These tools allow developers to create support workflows and improve user experiences.
These members ensure that users have access to assistance and feedback mechanisms, enhancing overall satisfaction.
The support method allows users to request feedback or support using specified arguments. This method is useful for initiating help or feedback workflows in the eTag Fuse platform.
Parameters
args (optional):
An object containing the support arguments:
'search'
or 'support'
.$fuse
instance.handler (optional):
A callback function to invoke after the operation is completed.
userContext (optional):
Additional information to pass to event listeners or the callback function.
Returns
Returns the $fuse
object, enabling method chaining.
Events
type
: The message type, set to Support
.response
: A message indicating the support request status (OK
for success or an error message).Example Usage
Initiate a support request:
$fuse.support({ "subject": "Need help!" });
Example: Add Event Listener
Add a listener for the OnSupport
event:
function onSupport(e) {
console.log('Support request status:', e.response);
}
$fuse.addEvent('OnSupport', onSupport);
Example: Remove Event Listener
Remove a specific listener:
$fuse.removeEvent('OnSupport', onSupport);
Remove all listeners for the event:
$fuse.clearEvent('OnSupport');
Occurs when a lock is successfully acquired.
Add an event listener:
$fuse.addEvent('OnAcquireLock', function (e) {
console.log('Lock acquired:', e.lockId);
});
Remove an event listener:
$fuse.removeEvent('OnAcquireLock', onAcquireLockHandler);
Remove all event listeners:
$fuse.clearEvent('OnAcquireLock');
Occurs when the application or window becomes active.
Add an event listener:
$fuse.addEvent('OnActivate', function (e) {
console.log('Window activated.');
});
Remove an event listener:
$fuse.removeEvent('OnActivate', onActivateHandler);
Remove all event listeners:
$fuse.clearEvent('OnActivate');
Triggers before the application or window is activated.
Add an event listener:
$fuse.addEvent('OnBeforeActivate', function (e) {
console.log('Before activation.');
});
Remove an event listener:
$fuse.removeEvent('OnBeforeActivate', onBeforeActivateHandler);
Remove all event listeners:
$fuse.clearEvent('OnBeforeActivate');
Occurs when the connection to the application or a service is lost.
Add an event listener:
$fuse.addEvent('OnConnectionLost', function (e) {
console.error('Connection lost.');
});
Remove an event listener:
$fuse.removeEvent('OnConnectionLost', onConnectionLostHandler);
Remove all event listeners:
$fuse.clearEvent('OnConnectionLost');
Occurs when the DOM (Document Object Model) is fully loaded and parsed.
Add an event listener:
$fuse.addEvent('OnDOMLoaded', function (e) {
console.log('DOM is ready.');
});
Remove an event listener:
$fuse.removeEvent('OnDOMLoaded', onDomLoadedHandler);
Remove all event listeners:
$fuse.clearEvent('OnDOMLoaded');
Triggers when a request fails.
Add an event listener:
$fuse.addEvent('OnFailRequest', function (e) {
console.error('Request failed: ', e.error);
});
Remove an event listener:
$fuse.removeEvent('OnFailRequest', onFailRequestHandler);
Remove all event listeners:
$fuse.clearEvent('OnFailRequest');
Occurs when the window or application is hidden.
Add an event listener:
$fuse.addEvent('OnHide', function (e) {
console.log('Window is hidden.');
});
Remove an event listener:
$fuse.removeEvent('OnHide', onHideHandler);
Remove all event listeners:
$fuse.clearEvent('OnHide');
Triggers when the application initializes.
Add an event listener:
$fuse.addEvent('OnInitialize', function (e) {
console.log('Application is initializing.');
});
Remove an event listener:
$fuse.removeEvent('OnInitialize', onInitializeHandler);
Remove all event listeners:
$fuse.clearEvent('OnInitialize');
Triggers when the application has completed loading.
Add an event listener:
$fuse.addEvent('OnLoad', function (e) {
console.log('Application has loaded.');
});
Remove an event listener:
$fuse.removeEvent('OnLoad', onLoadHandler);
Remove all event listeners:
$fuse.clearEvent('OnLoad');
Triggers when the window is maximized.
Add an event listener:
$fuse.addEvent('OnMaximize', function (e) {
console.log('Window maximized.');
});
Remove an event listener:
$fuse.removeEvent('OnMaximize', onMaximizeHandler);
Remove all event listeners:
$fuse.clearEvent('OnMaximize');
Event Argument
Property | Type | Description |
---|---|---|
type |
string |
The message type. Value: Maximize . |
response |
object |
The message. An 'OK' value indicates success; otherwise, an error. |
Occurs when the window is minimized.
Add an event listener:
$fuse.addEvent('OnMinimize', function (e) {
console.log('Window minimized.');
});
Remove an event listener:
$fuse.removeEvent('OnMinimize', onMinimizeHandler);
Remove all event listeners:
$fuse.clearEvent('OnMinimize');
Triggers when the window is restored from maximized to a smaller size.
Add an event listener:
$fuse.addEvent('OnRestoreDown', function (e) {
console.log('Window restored down.');
});
Remove an event listener:
$fuse.removeEvent('OnRestoreDown', onRestoreDownHandler);
Remove all event listeners:
$fuse.clearEvent('OnRestoreDown');
Occurs when the window is restored to its original size after being minimized or resized.
Add an event listener:
$fuse.addEvent('OnRestoreUp', function (e) {
console.log('Window restored up.');
});
Remove an event listener:
$fuse.removeEvent('OnRestoreUp', onRestoreUpHandler);
Remove all event listeners:
$fuse.clearEvent('OnRestoreUp');
Triggers when the window or application is shown.
Add an event listener:
$fuse.addEvent('OnShow', function (e) {
console.log('Window is visible.');
});
Remove an event listener:
$fuse.removeEvent('OnShow', onShowHandler);
Remove all event listeners:
$fuse.clearEvent('OnShow');
Occurs when the window is snapped to a specific position.
Add an event listener:
$fuse.addEvent('OnSnap', function (e) {
console.log('Window snapped to position:', e.position);
});
Remove an event listener:
$fuse.removeEvent('OnSnap', onSnapHandler);
Remove all event listeners:
$fuse.clearEvent('OnSnap');
Triggers when a window or element is pinned.
Add an event listener:
$fuse.addEvent('OnPin', function (e) {
console.log('Element pinned:', e.elementId);
});
Remove an event listener:
$fuse.removeEvent('OnPin', onPinHandler);
Remove all event listeners:
$fuse.clearEvent('OnPin');
Occurs when a window or element is unpinned.
Add an event listener:
$fuse.addEvent('OnUnpin', function (e) {
console.log('Element unpinned:', e.elementId);
});
Remove an event listener:
$fuse.removeEvent('OnUnpin', onUnpinHandler);
Remove all event listeners:
$fuse.clearEvent('OnUnpin');
Occurs when a modal window is opened.
Add an event listener:
$fuse.addEvent('OnModal', function (e) {
console.log('Modal window opened.');
});
Remove an event listener:
$fuse.removeEvent('OnModal', onModalHandler);
Remove all event listeners:
$fuse.clearEvent('OnModal');
Triggers when a request fails.
Add an event listener:
$fuse.addEvent('OnFailRequest', function (e) {
console.error('Request failed: ', e.error);
});
Remove an event listener:
$fuse.removeEvent('OnFailRequest', onFailRequestHandler);
Remove all event listeners:
$fuse.clearEvent('OnFailRequest');
Occurs when the connection to the application or a service is lost.
Add an event listener:
$fuse.addEvent('OnConnectionLost', function (e) {
console.error('Connection lost.');
});
Remove an event listener:
$fuse.removeEvent('OnConnectionLost', onConnectionLostHandler);
Remove all event listeners:
$fuse.clearEvent('OnConnectionLost');
Triggers when a connection is successfully established.
Add an event listener:
$fuse.addEvent('OnConnect', function (e) {
console.log('Connection established:', e.connectionDetails);
});
Remove an event listener:
$fuse.removeEvent('OnConnect', onConnectHandler);
Remove all event listeners:
$fuse.clearEvent('OnConnect');
Occurs when a connection is intentionally or unintentionally disconnected.
Add an event listener:
$fuse.addEvent('OnDisconnect', function (e) {
console.log('Disconnected:', e.reason);
});
Remove an event listener:
$fuse.removeEvent('OnDisconnect', onDisconnectHandler);
Remove all event listeners:
$fuse.clearEvent('OnDisconnect');
Occurs before a message is sent.
Add an event listener:
$fuse.addEvent('OnBeforeMessage', function (e) {
console.log('Preparing to send message.');
});
Remove an event listener:
$fuse.removeEvent('OnBeforeMessage', onBeforeMessageHandler);
Remove all event listeners:
$fuse.clearEvent('OnBeforeMessage');
Triggers when a broadcast message is sent.
Add an event listener:
$fuse.addEvent('OnBroadcast', function (e) {
console.log('Broadcast message:', e.message);
});
Remove an event listener:
$fuse.removeEvent('OnBroadcast', onBroadcastHandler);
Remove all event listeners:
$fuse.clearEvent('OnBroadcast');
Occurs after a broadcast message is processed.
Add an event listener:
$fuse.addEvent('OnAfterBroadcast', function (e) {
console.log('Broadcast processing complete.');
});
Remove an event listener:
$fuse.removeEvent('OnAfterBroadcast', onAfterBroadcastHandler);
Remove all event listeners:
$fuse.clearEvent('OnAfterBroadcast');
Triggers when a message is received by the application.
Add an event listener:
$fuse.addEvent('OnMessage', function (e) {
console.log('Message received:', e.message);
});
Remove an event listener:
$fuse.removeEvent('OnMessage', onMessageHandler);
Remove all event listeners:
$fuse.clearEvent('OnMessage');
Occurs when a button in a message dialog is clicked.
Add an event listener:
$fuse.addEvent('OnMessageButtonClick', function (e) {
console.log('Button clicked:', e.button);
});
Remove an event listener:
$fuse.removeEvent('OnMessageButtonClick', onMessageButtonClickHandler);
Remove all event listeners:
$fuse.clearEvent('OnMessageButtonClick');
Occurs when a feature is invoked.
Add an event listener:
$fuse.addEvent('OnInvokeFeature', function (e) {
console.log('Feature invoked:', e.feature);
});
Remove an event listener:
$fuse.removeEvent('OnInvokeFeature', onInvokeFeatureHandler);
Remove all event listeners:
$fuse.clearEvent('OnInvokeFeature');
Triggers when a remote procedure call (RPC) is executed.
Add an event listener:
$fuse.addEvent('OnExecRPC', function (e) {
console.log('RPC executed:', e.rpcDetails);
});
Remove an event listener:
$fuse.removeEvent('OnExecRPC', onExecRPCHandler);
Remove all event listeners:
$fuse.clearEvent('OnExecRPC');
Triggers when features are requested by a connected client or system.
Add an event listener:
$fuse.addEvent('OnNeedFeatures', function (e) {
console.log('Features requested:', e.features);
});
Remove an event listener:
$fuse.removeEvent('OnNeedFeatures', onNeedFeaturesHandler);
Remove all event listeners:
$fuse.clearEvent('OnNeedFeatures');
Occurs when the speech recognition service starts listening to audio input.
Add an event listener:
$fuse.addEvent('OnSpeechRecognitionStart', function (e) {
console.log('Speech recognition started.');
});
Remove an event listener:
$fuse.removeEvent('OnSpeechRecognitionStart', onSpeechRecognitionStartHandler);
Remove all event listeners:
$fuse.clearEvent('OnSpeechRecognitionStart');
Triggers when the speech recognition service processes audio and returns a result.
Add an event listener:
$fuse.addEvent('OnSpeechRecognitionResult', function (e) {
console.log('Speech recognition result:', e.result);
});
Remove an event listener:
$fuse.removeEvent('OnSpeechRecognitionResult', onSpeechRecognitionResultHandler);
Remove all event listeners:
$fuse.clearEvent('OnSpeechRecognitionResult');
Occurs when an error is encountered during speech recognition.
Add an event listener:
$fuse.addEvent('OnSpeechRecognitionError', function (e) {
console.error('Speech recognition error:', e.error);
});
Remove an event listener:
$fuse.removeEvent('OnSpeechRecognitionError', onSpeechRecognitionErrorHandler);
Remove all event listeners:
$fuse.clearEvent('OnSpeechRecognitionError');
Triggers when the speech recognition service stops listening and processing.
Add an event listener:
$fuse.addEvent('OnSpeechRecognitionEnd', function (e) {
console.log('Speech recognition ended.');
});
Remove an event listener:
$fuse.removeEvent('OnSpeechRecognitionEnd', onSpeechRecognitionEndHandler);
Remove all event listeners:
$fuse.clearEvent('OnSpeechRecognitionEnd');
Occurs when a resource is successfully loaded.
Add an event listener:
$fuse.addEvent('OnResourceLoaded', function (e) {
console.log('Resource loaded:', e.url);
});
Remove an event listener:
$fuse.removeEvent('OnResourceLoaded', onResourceLoadedHandler);
Remove all event listeners:
$fuse.clearEvent('OnResourceLoaded');
Occurs when the navigation bar is reloaded.
Add an event listener:
$fuse.addEvent('OnReloadNavbar', function (e) {
console.log('Navigation bar reloaded.');
});
Remove an event listener:
$fuse.removeEvent('OnReloadNavbar', onReloadNavbarHandler);
Remove all event listeners:
$fuse.clearEvent('OnReloadNavbar');
Triggers when the window title is updated.
Add an event listener:
$fuse.addEvent('OnSetTitle', function (e) {
console.log('Title updated to:', e.title);
});
Remove an event listener:
$fuse.removeEvent('OnSetTitle', onSetTitleHandler);
Remove all event listeners:
$fuse.clearEvent('OnSetTitle');
Triggers when a variable's value changes.
Add an event listener:
$fuse.addEvent('OnVariableChange', function (e) {
console.log('Variable changed:', e.name, 'New value:', e.value);
});
Remove an event listener:
$fuse.removeEvent('OnVariableChange', onVariableChangeHandler);
Remove all event listeners:
$fuse.clearEvent('OnVariableChange');
Triggers when a variable observer is registered.
Add an event listener:
$fuse.addEvent('OnObserveVar', function (e) {
console.log('Started observing variable:', e.name);
});
Remove an event listener:
$fuse.removeEvent('OnObserveVar', onObserveVarHandler);
Remove all event listeners:
$fuse.clearEvent('OnObserveVar');
Occurs when a variable observer is removed.
Add an event listener:
$fuse.addEvent('OnUnobserveVar', function (e) {
console.log('Stopped observing variable:', e.name);
});
Remove an event listener:
$fuse.removeEvent('OnUnobserveVar', onUnobserveVarHandler);
Remove all event listeners:
$fuse.clearEvent('OnUnobserveVar');
Occurs when a lock is successfully acquired.
Add an event listener:
$fuse.addEvent('OnAcquireLock', function (e) {
console.log('Lock acquired.');
});
Remove an event listener:
$fuse.removeEvent('OnAcquireLock', onAcquireLockHandler);
Remove all event listeners:
$fuse.clearEvent('OnAcquireLock');
Occurs when a lock is successfully extended.
Add an event listener:
$fuse.addEvent('OnExtendLock', function (e) {
console.log('Lock extended.');
});
Remove an event listener:
$fuse.removeEvent('OnExtendLock', onExtendLockHandler);
Remove all event listeners:
$fuse.clearEvent('OnExtendLock');
Triggers when the interpreter starts.
Add an event listener:
$fuse.addEvent('OnStartInterpreter', function (e) {
console.log('Interpreter started.');
});
Remove an event listener:
$fuse.removeEvent('OnStartInterpreter', onStartInterpreterHandler);
Remove all event listeners:
$fuse.clearEvent('OnStartInterpreter');
Triggers when the interpreter stops.
Add an event listener:
$fuse.addEvent('OnStopInterpreter', function (e) {
console.log('Interpreter stopped.');
});
Remove an event listener:
$fuse.removeEvent('OnStopInterpreter', onStopInterpreterHandler);
Remove all event listeners:
$fuse.clearEvent('OnStopInterpreter');
Fires before an interpreter event is executed.
Add an event listener:
$fuse.addEvent('OnBeforeInterpreterEvent', function (e) {
console.log('Interpreter event about to execute:', e.eventName);
});
Remove an event listener:
$fuse.removeEvent('OnBeforeInterpreterEvent', onBeforeInterpreterEventHandler);
Remove all event listeners:
$fuse.clearEvent('OnBeforeInterpreterEvent');
Occurs when user activity is applied or recorded in the platform.
Add an event listener:
$fuse.addEvent('OnApplyUserActivity', function (e) {
console.log('User activity recorded:', e.activityType);
});
Remove an event listener:
$fuse.removeEvent('OnApplyUserActivity', onApplyUserActivityHandler);
Remove all event listeners:
$fuse.clearEvent('OnApplyUserActivity');
Fires when a support or feedback request is submitted.
Add an event listener:
$fuse.addEvent('OnSupport', function (e) {
console.log('Support request submitted:', e.requestId);
});
Remove an event listener:
$fuse.removeEvent('OnSupport', onSupportHandler);
Remove all event listeners:
$fuse.clearEvent('OnSupport');
Occurs when a shortcut is assigned or modified.
Add an event listener:
$fuse.addEvent('OnSetShortcut', function (e) {
console.log('Shortcut set for:', e.actionName);
});
Remove an event listener:
$fuse.removeEvent('OnSetShortcut', onSetShortcutHandler);
Remove all event listeners:
$fuse.clearEvent('OnSetShortcut');
Occurs when the lock state of the application or window changes.
Add an event listener:
$fuse.addEvent('OnLockChanged', function (e) {
console.log('Lock state changed:', e.locked);
});
Remove an event listener:
$fuse.removeEvent('OnLockChanged', onLockChangedHandler);
Remove all event listeners:
$fuse.clearEvent('OnLockChanged');
Occurs when a window or UI element becomes visible.
Add an event listener:
$fuse.addEvent('OnShow', function (e) {
console.log('Element shown:', e.elementId);
});
Remove an event listener:
$fuse.removeEvent('OnShow', onShowHandler);
Remove all event listeners:
$fuse.clearEvent('OnShow');
Occurs when a window or UI element is hidden.
Add an event listener:
$fuse.addEvent('OnHide', function (e) {
console.log('Element hidden:', e.elementId);
});
Remove an event listener:
$fuse.removeEvent('OnHide', onHideHandler);
Remove all event listeners:
$fuse.clearEvent('OnHide');
Occurs when a window or element is pinned.
Add an event listener:
$fuse.addEvent('OnPin', function (e) {
console.log('Window pinned:', e.elementId);
});
Remove an event listener:
$fuse.removeEvent('OnPin', onPinHandler);
Remove all event listeners:
$fuse.clearEvent('OnPin');
Occurs when a window or element is unpinned.
Add an event listener:
$fuse.addEvent('OnUnpin', function (e) {
console.log('Window unpinned:', e.elementId);
});
Remove an event listener:
$fuse.removeEvent('OnUnpin', onUnpinHandler);
Remove all event listeners:
$fuse.clearEvent('OnUnpin');
Occurs when a window is snapped into position.
Add an event listener:
$fuse.addEvent('OnSnap', function (e) {
console.log('Window snapped to position:', e.position);
});
Remove an event listener:
$fuse.removeEvent('OnSnap', onSnapHandler);
Remove all event listeners:
$fuse.clearEvent('OnSnap');
Triggers when the interpreter starts.
Add an event listener:
$fuse.addEvent('OnInterpreterStart', function (e) {
console.log('Interpreter started.');
});
Remove an event listener:
$fuse.removeEvent('OnInterpreterStart', onInterpreterStartHandler);
Remove all event listeners:
$fuse.clearEvent('OnInterpreterStart');
Triggers when the interpreter stops.
Add an event listener:
$fuse.addEvent('OnInterpreterStop', function (e) {
console.log('Interpreter stopped.');
});
Remove an event listener:
$fuse.removeEvent('OnInterpreterStop', onInterpreterStopHandler);
Remove all event listeners:
$fuse.clearEvent('OnInterpreterStop');
Occurs when the speech recognition service starts listening to audio input.
Add an event listener:
$fuse.addEvent('OnSpeechRecognitionStart', function (e) {
console.log('Speech recognition started.');
});
Remove an event listener:
$fuse.removeEvent('OnSpeechRecognitionStart', onSpeechRecognitionStartHandler);
Remove all event listeners:
$fuse.clearEvent('OnSpeechRecognitionStart');
Triggers when the speech recognition service processes audio and returns a result.
Add an event listener:
$fuse.addEvent('OnSpeechRecognitionResult', function (e) {
console.log('Speech recognition result:', e.result);
});
Remove an event listener:
$fuse.removeEvent('OnSpeechRecognitionResult', onSpeechRecognitionResultHandler);
Remove all event listeners:
$fuse.clearEvent('OnSpeechRecognitionResult');
Occurs when an error is encountered during speech recognition.
Add an event listener:
$fuse.addEvent('OnSpeechRecognitionError', function (e) {
console.error('Speech recognition error:', e.error);
});
Remove an event listener:
$fuse.removeEvent('OnSpeechRecognitionError', onSpeechRecognitionErrorHandler);
Remove all event listeners:
$fuse.clearEvent('OnSpeechRecognitionError');
Triggers when the speech recognition service stops listening and processing.
Add an event listener:
$fuse.addEvent('OnSpeechRecognitionEnd', function (e) {
console.log('Speech recognition ended.');
});
Remove an event listener:
$fuse.removeEvent('OnSpeechRecognitionEnd', onSpeechRecognitionEndHandler);
Remove all event listeners:
$fuse.clearEvent('OnSpeechRecognitionEnd');
Occurs when the navigation bar is reloaded.
Add an event listener:
$fuse.addEvent('OnReloadNavbar', function (e) {
console.log('Navigation bar reloaded.');
});
Remove an event listener:
$fuse.removeEvent('OnReloadNavbar', onReloadNavbarHandler);
Remove all event listeners:
$fuse.clearEvent('OnReloadNavbar');
Occurs when a shortcut is assigned or modified.
Add an event listener:
$fuse.addEvent('OnSetShortcut', function (e) {
console.log('Shortcut set:', e.shortcutDetails);
});
Remove an event listener:
$fuse.removeEvent('OnSetShortcut', onSetShortcutHandler);
Remove all event listeners:
$fuse.clearEvent('OnSetShortcut');
Triggers when a variable value changes.
Add an event listener:
$fuse.addEvent('OnVariableChange', function (e) {
console.log('Variable changed:', e.variableName, 'New value:', e.newValue);
});
Remove an event listener:
$fuse.removeEvent('OnVariableChange', onVariableChangeHandler);
Remove all event listeners:
$fuse.clearEvent('OnVariableChange');
Triggers when features are requested by a connected client or system.
Add an event listener:
$fuse.addEvent('OnNeedFeatures', function (e) {
console.log('Features requested:', e.features);
});
Remove an event listener:
$fuse.removeEvent('OnNeedFeatures', onNeedFeaturesHandler);
Remove all event listeners:
$fuse.clearEvent('OnNeedFeatures');