Add a framework for synchronously executed preInit and preStepLeave plugins.

This allows plugins to register to be executed at the beginning of
impress().init() and impress().goto() respectively. By returning false,
a plugin can also cancel the event.

Also adds 3 plugins that use this: rel, goto and stop.
This commit is contained in:
Henrik Ingo
2017-10-11 18:41:02 +03:00
parent 8902a0a709
commit 82ff7cbde0
8 changed files with 767 additions and 43 deletions

View File

@@ -0,0 +1,24 @@
Goto Plugin
===========
The goto plugin is a pre-stepleave plugin. It is executed before
`impress:stepleave` event, and will alter the destination where to transition next.
Example:
<!-- When leaving this step, go directly to "step-5" -->
<div class="step" data-goto="step-5">
<!-- When leaving this step with next(), go directly to "step-5", instead of the next step.
If moving backwards to previous step - e.g. prev() instead of next() - then go to "step-1". -->
<div class="step" data-goto-next="step-5" data-goto-prev="step-1">
<!-- data-goto-key-list and data-goto-next-list allow you to build advanced non-linear navigation. -->
<div class="step" data-goto-key-list="ArrowUp ArrowDown ArrowRight ArrowLeft" data-goto-next-list="step-4 step-3 step-2 step-5">
Author
------
Copyright 2016 Henrik Ingo (@henrikingo)
Released under the MIT license.