-
Notifications
You must be signed in to change notification settings - Fork 2
Handler API
The following is for reference. For an explanation of how DEJE works, go to the Technical Overview.
In your handler, you will have access to an object called "deje" in the global namespace. For Lua this is a table, for JavaScript it's an Object. The difference is essentially semantic. This object has properties and functions for interacting with your interpreter's host environment.
Get the resource in this document that's available at the given path. Resources have the following properties:
- path
- type (MIME, basically)
- content
- comment
Content can be in any format, all other properties are plain strings.
Create a checkpoint based on the arbitrary object cp.
Print a debug message. At some point this will be disabled by default and only used for unit testing, but currently, such a switch does not exist.
Get the host's current value of self-identity. May be None (or rather, it's equivalent in the handler's language)
You can expose functions in the handler for events - in fact, that's the only useful way to do anything with a handler. Any functions by the following names, available in your interpreter's global namespace, will be called at the appropriate times by the host.
This is triggered on changes to any property of a resource. In most of these cases, oldpath will be None, but if the path property has changed (property_name == path), the previous path is delivered in the oldpath variable. The following are valid results for property_name, see deje.handlers.lua.echo_chamber for more information.
- path
- type
- content
- comment
- add
- remove
0.0.2