Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
rohitchouhan
Participant
1,165

The DelayCode custom widget is a custom timing delay component designed for integration with SAP Analytics Cloud. It provides a simple API for introducing delays, which can be useful in scenarios such as waiting for user interactions, pacing animations, or managing asynchronous operations.

Workflow

DelayCode Work Flow.jpg

Usage

To get started with DelayCode, simply download the DelayCode.json file from the link below. Then, just follow the instructions provided to install DelayCode in your SAP Analytics Cloud environment.

GitHub Repository: https://github.com/SAP-Custom-Widget/DelayCode
Direct Download: https://sap-custom-widget.rohitchouhan.com/?dl=DelayCode

  • Download the DelayCode.json.
  • Go to your SAC Portal, select Stories/Analytic Application from the left sidebar, and then go to the Custom Widget tab.
  • Click on the + icon on the right side and select the CacheBuddy.json file that you downloaded.
  • You're done! You can now use it in your app.

Methods

The DelayCode widget exposes the following method:

delay

  • Description: Introduces a delay for the specified number of milliseconds. This method can return a boolean value indicating whether the operation was successful.

  • Parameters:

    • milliseconds (number): The number of milliseconds to delay before the method resolves. For example, passing 1000 will result in a 1-second delay.
  • Return Type: boolean

  • Usage Example:

// Logs a greeting message to the console on initialization
console.log("Hello There");
// Output: Hello There

// Introduces a delay of 10,000 milliseconds (10 seconds)
DelayCode_1.delay(10000);

// Logs a farewell message after the delay completes
console.log("Bye, See you");
// Output: Bye, See you (after 10 seconds)

Events

onTimeOut

This widget exposes a single event named onTimeOut, which serves as a determinative callback that is triggered upon the completion of the configured delay interval.

Conclusion

The DelayCode widget is a lightweight tool that integrates smoothly into the SAP Analytics Cloud environment, allowing developers to implement timing delays efficiently. Future versions may expand functionality with additional properties and event handling capabilities.