I made a wait module - "wait x seconds"

Hi everyone :wave:

I just joined the community 2 days ago. Albeit some UI bugs here and there, an autosave option… I’m very happy with Wappler and looking forward to its future, great job! :slight_smile:

Back to the topic, I needed a wait module for my workflow today. So I made one and I’m sharing it here with you, in case anyone finds it helpful. I find it convenient for quickly dropping wait actions, e.g. when servers immediately respond with an update ID for you to check later while they’re still processing in the background.

It’s very simple: it’s just an action that waits for x seconds. You can always augment it with your fancy options if you want :slight_smile:


Tested in my workflow

5 seconds



Anyways, here’s the zip file. Just extract it and drop it at the root of your project
extensions.zip (5.2 KB)

For those of you not fond of zip files as I am, here’s a quick run down, should be easy to set up yourself in a few seconds:

  1. UI - /extensions/server_connect/modules/wait.hjson
    {
      type: 'wait',
      module : 'wait',
      action : 'wait',
      groupTitle : 'My Modules',
      groupIcon : 'fas fa-lg fa-project-diagram',
      title : 'Wait',
      icon : 'fa fa-clock-o',
      dataPickObject: true,
      properties : [
    {
      group: 'Wait',
      variables: [
        { name: 'name', optionName: 'name', title: 'Name', type: 'text', required: true, defaultValue: ''},
        { name: 'seconds', optionName: 'seconds', title: 'Seconds', type: 'text', required: true, defaultValue: ''},
      ]
    }
      ]
    }
  1. The action code - /extensions/server_connect/modules/wait.js
    function sleep(ms) {
        return new Promise((resolve) => {
            setTimeout(resolve, ms);
        });
    }
    exports.wait = function (options) {
        let seconds = this.parse(options.seconds);
        return sleep(options.seconds * 1000);
    }

That’s it, just go to your steps and drop the wait action. You can find it inside “My Modules” :white_check_mark:


Screen Shot 2021-01-28 at 20.01.39

Hope you’re having as much fun as I am building with Wappler!

3 Likes

Hi.
Thanks for sharing. :slightly_smiling_face:
I created a similar one for PHP few days ago: Sleep/Wait for PHP
I will be extending that to NodeJS too.

One tip for the module title in hjson:

title : 'Wait @@var(seconds)@@',

Setting title in this fashion will show the delay time value in the steps itself, without having to click on it to check the entered value.

image

1 Like

Super cool, made my interface much cleaner to see :sparkles:
Thanks for sharing this tip!