Introduction

An introduction to WRT, what it is, and how it works.

WRT (which stands for Windows 96 RunTime) is the JavaScript execution environment for Windows 96 scripts. All script files are ran under WRT unless explicitly told not to do so.

If this sounds confusing, there is no need to panic - its all seamless and completely transparent to the user.

How is WRT different from eval based execution?

Scripts running under WRT are:

  • ran in their own scope to prevent global namespace pollution

  • designed to efficiently handle resources such as Blobs when the correct paradigm is used.

  • able to create dependencies using await include("my_script.js"), which follows the CommonJS format with some twists.

  • able to identify the environment from which they are executed (terminal, GUI, etc.)

  • asynchronous by default

Aliased functions and objects

WRT aliases the most common functions/objects in Windows 96 but also aliases functions/objects available to a script running under WRT. These are:

  • current - the WRTParameters that were used to start the script.

  • FS - an alias for w96.FS, the object used to interact with the file system.

  • FSUtil - an alias for w96.FSUtil, an object used to store file system utility functions.

  • env - an alias for current.env.

  • WApplication - an alias for w96.WApplication, a class used to write structured applications.

  • StandardWindow - an alias for w96.StandardWindow, a class used to construct GUI windows.

  • registerApp - an alias for w96.sys.reg.registerApp, a function used to register applications.

  • deregisterApp - an alias for w96.sys.reg.deregisterApp, a function used to deregister applications.

To WRT or not to WRT?

That depends on your use case.

If you're creating an application or some kind of library, you should be using WRT. The overhead is minimal and it provides a lot back for the developer (e.g. automatic handling of scope, dependencies, as mentioned before).

If you wish to have more control or simply don't want the additional features, you may want to use an eval based script.

Last updated