From 95898dc9e37046d9cd484159ed2700e89aa3abae Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sat, 11 Aug 2012 21:52:56 -0300 Subject: [PATCH] document dependency loading --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 3266848..12b931f 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,26 @@ Reveal.initialize({ }); ``` +### Dependencies + +Reveal.js doesn't _rely_ on any third party scripts to work but a few optional libraries are included by default. These libraries are loaded as dependencies in the order they appear, for example: + +```javascript +Reveal.initialize({ + dependencies: [ + { src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } }, + { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } } + ] +}); +``` + +You can add your own extensions using the same syntax. The following properties are available for each dependency object: +- **src**: Path to the script to load +- **async**: [optional] Flags if the script should load after reveal.js has started, defaults to false +- **callback**: [optional] Function to execute when the script has loaded +- **condition**: [optional] Function which must return true for the script to be loaded + + ### API The Reveal class provides a minimal JavaScript API for controlling navigation and reading state: