Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Synchronet Synchronet
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 224
    • Issues 224
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

This GitLab instance has migrated as of Nov-5-2022 to a new server: hardware, OS, SSH key

The v3.20a development branch has now been merged to the master branch. Sysops upgrading from earlier versions must run 'jsexec update'

  • MainMain
  • SynchronetSynchronet
  • Merge requests
  • !118

Implement support for callback style programming

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Deucе requested to merge Deuce/sbbs:echicken-less-grumpy into master Mar 31, 2021
  • Overview 4
  • Commits 47
  • Pipelines 53
  • Changes 16

If js.do_callbacks 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, callbacks can be added with the following new methods:

  • js.setInterval(callback_function, period_in_ms[, thisObj]);
  • js.setTimeout(callback_function, timeout_in_ms[, thisObj]);
  • SocketInstance.on('read' | 'write', callback_function);
  • SocketInstance.once('read' | 'write', callback_function);
  • SocketInstance.connect(host, port, callback_function);
  • console.on('read', callback_function);
  • console.once('read', 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);
  • console.clearOn('read' | 'write', id);
  • console.clearOnce('read' | 'write', id);

Additionally, user-defined events are now supported:

  • js.addEventListener(eventName, callback)
  • js.removeEventListener(id)
  • js.dispatchEvent(eventName[, thisObj])

We also get a cool event-based DNS library.

Edited Apr 02, 2021 by Deucе
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: echicken-less-grumpy