Skip to content

Commit

Permalink
Updated version and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
newcat committed Mar 27, 2019
1 parent 968514f commit f4f512d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 36 deletions.
11 changes: 11 additions & 0 deletions docs/event-system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Event System

BaklavaJS uses a custom event system to allow for extensibility and plugins. Each class that supports has an `events` and/or a `hook` property, which can be used to subscribe to an event or tap into a hook.

Most JS event systems need a reference to the listener function to remove an event listener. However, this doesn't work well with inline arrow-functions. To support such functions as well, Baklava uses so-called `tokens` for adding and removing a listener. The token can be any reference-type (for example and object, array, or `this` when you are in a class) or symbol. It is provided when adding an event listener and provided again when removing the listener.

## Events
There are two types of events: *normal* and *preventable* events. *Normal* events are usually fired after an action, to react on that action. *Preventable* events, on the other hand, are fired before an action and can be used by the listener to prevent the action from happening. This is done by returning `false` in a listener function. Most preventable events have the `before` prefix in their name.

## Hooks
Hooks are similar to events, however, hooks have the ability to pass data from one hook to another. They are executed in the order they have been tapped into.
35 changes: 0 additions & 35 deletions jsdoc2md.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "baklavajs",
"version": "0.6.4",
"version": "0.7.0",
"description": "Node/Graph editor for the browser using VueJS",
"keywords": [
"node",
Expand Down

0 comments on commit f4f512d

Please sign in to comment.