Last active
January 4, 2016 22:08
-
-
Save commuterjoy/8685338 to your computer and use it in GitHub Desktop.
Previewing interactives on theguardian.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['common/modules/interactive/loader', 'common/$'], function (Interactive, $) { | |
// remove the incumbent interactive | |
$('.interactive').empty(); | |
// set the data- attribute to a boot module | |
$('.interactive').attr('data-interactive', 'http://path/to/boot.js'); | |
// initialise the interactive | |
new Interactive(document.querySelector('figure.interactive'), document, guardian.config).init(); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because everything is an AMD module in NGW we can use web inspector to reload the interactive AMD module, change the figure data attribute (the path to boot.js) and re-load the interactive.
This can be used to test new versions of boot.js as well as test interactive.
Use http://proxylocal.com/ to access files on your localhost.