jsolait
This is the main module.It provides a simple way for class inheritance and module loading capabilities.
The module automatically loads the stringformat module.
classes
- Class
A function for creating classes. - Module
A function for creating new modules. - Exception
Base class for all exceptions.
exceptions
- ModuleImportFailed
Thrown when a module could not be imported.
properties:
- moduleName
The name of the module that could not be found. - url
The URL of the module.
- moduleName
- EvalFailed
Thrown when a script source could not be loaded due to an interpretation error.
properties:
- url
The URL of the module.
- url
methods
- importModule(name)
Imports a module given its name(e.g. "xmlrpc").
A module's file location is determined by treating each module name as a directory.
Only the last one points to a file. If the module's URL is not known to jsolait then it will first be searched for in the jsolait/ext path. If that fails then it will be searched for in the baseURL(jsolait.baseURL which is "./" by default).
parameters:- name The name of the module to load.(e.g. "xmlrpc")
The module object. - registerModule(module)
Registers a new module using it's name.
Registered modules can be imported with importModule(moduleName).
parameters:- module The module to register.
- reportException(exception)
Displays an exception and it's trace.
This works better than alert(e) because traces are taken into account.
parameters:- exception The exception to display.
- loadScript(url)
Loads and interprets a script file.
parameters:- url The url of the script to load.
properties
- baseURL
The URL base for loading user modules(this is like the current working dir) (defaults to "."). - libURL
The URL where jsolait is located at (defaults to "./jsolait"). - modules
Collection of all loaded modules.(module cache)
globals
requirements
For importModule to load script sources for modules if needed the JavaScript engine needs to provide a way to retrieve files synchronously given a URL.See the requirements for synchronous http requests in urllib. If the JavaScript engine does not provide synchronous requests then all needed module scripts need to be included into e.g. the webpage by refference using the script element.