Commit Graph

54 Commits

Author SHA1 Message Date
Henrik Ingo
82ff7cbde0 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.
2017-10-21 12:22:22 +03:00
Henrik Ingo
f3d193d636 Move helper functions from core to src/lib/util.js
This facilitates them being used from plugins as well as core impress.js.
2017-10-05 17:57:16 +03:00
Henrik Ingo
9b958f0e00 Add a framework for libraries, and a first library gc
- Libraries are under src/lib/
- Added to build.js as usual, before plugins.
- See src/lib/README.md for details

gc library implements a "garbage collector" library, which allows
both the core and plugins to store elements and listeners to a list,
and when impress().lib.gc.teardown() is called, to have all of them
removed from the DOM. It also allows plugins to register their own
callback functions, which are called at teardown.

Commentary:

This work is based on copying the src/lib/gc.js from impressionist. While it was
useful, it turns out on the impress.js side there was much more a need to reset
attributes rather than delete elements. For now, this means lots of plugins do this
via their own lib.gc.addCallback() functions. Probably it would be nicer to add
some generic lib.gc.resetAttributes() functionality for this particular case.
I'll return to this in a future patch.

extras/ are not supported for impress().tear(). What can I say, they're extras.
Maybe in the future I'll support them, for now I can live without.
2017-10-05 14:57:59 +03:00
Henrik Ingo
0dc8b43650 Introduce plugin framework
* Source files are under src/
* js/impress.js is now generated, but remains part of the repo (so it just works)
* npm run build
* build.js uses buildify node module
* Break out navigation and resize plugins from core src/impress.js file
2017-09-25 03:01:58 +03:00