diff options
author | Victor Häggqvist <[email protected]> | 2016-01-16 22:00:36 +0100 |
---|---|---|
committer | Victor Häggqvist <[email protected]> | 2016-01-16 22:00:36 +0100 |
commit | 60d6c5f3e46b887806e252d5dea1f04715a81e0d (patch) | |
tree | ec87e4bd38fd6e59a26e24bfd57145a4f77e5147 /docs/hacking.rst | |
parent | 47b575b89249f34a364b516161cbe1e33df0f3a4 (diff) |
write some docs and fixup demo
Diffstat (limited to 'docs/hacking.rst')
-rw-r--r-- | docs/hacking.rst | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/hacking.rst b/docs/hacking.rst new file mode 100644 index 0000000..14d3810 --- /dev/null +++ b/docs/hacking.rst @@ -0,0 +1,20 @@ +Hacking +======= +A plugin are expected to implement a function :code:`register(lightbox)` which will be called when passed the plugin to `LightBox.Core::registerPlugin`. See the full API at :doc:`api`. + +A basic plugin could look like this. + +.. code-block:: js + :caption: LightBox.Contrib.MyExitPlugin.js + + class MyExitPlugin { + + register(lightbox) { + lightbox.addOnEndListener(this.exited.bind(this)); + } + + exited() { + console.log('lightbox exited'); + } + + } |