Skip to content
Snippets Groups Projects

Implement support for event style programming

Closed Deucе requested to merge Deuce/sbbs:echicken-less-grumpy into master

If js.keepGoing is set to true, a script will not terminate when it finishes. Instead, it will enter an event loop running installed callbacks when configured events occurs. Currently, events can be added with the following new methods:

  • js.setInterval(callback_function, period_in_ms);
  • js.setTimeout(callback_function, timeout_in_ms);
  • SocketInstance.on('read' | 'write', callback_function);
  • SocketInstance.once('read' | 'write', callback_function);
  • SocketInstance.connect(host, port, callback_function);

Aside from Socket.connect(), these functions return a value that can be passed to a matching clear function:

  • js.clearInterval(id);
  • js.clearTimeout(id);
  • SocketInstance.clearOn('read' | 'write', id);
  • SocketInstance.clearOnce('read' | 'write', id);
Edited by Deucе

Merge request reports

Merge request pipeline #1674 passed

Merge request pipeline passed for 86d47bf9

Approval is optional

Closed by DeucеDeucе 4 years ago (Mar 31, 2021 5:06am UTC)

Merge details

  • The changes were not merged into master.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading