Skip to content

Instantly share code, notes, and snippets.

@LukeMurphey
Created September 15, 2015 21:27
Show Gist options
  • Select an option

  • Save LukeMurphey/38dcf31ca9e5a0ca29fc to your computer and use it in GitHub Desktop.

Select an option

Save LukeMurphey/38dcf31ca9e5a0ca29fc to your computer and use it in GitHub Desktop.
Illustrates how to conditionally load dashboard.js in Splunk #Splunk
require([
"splunkjs/mvc",
"underscore",
"jquery",
"splunkjs/mvc/utils"
],
function(
mvc,
_,
$,
utils ) {
// Try to load dashboard.js
require(['../app/' + utils.getCurrentApp() + '/dashboard'], function () {
console.log("Successfully loaded dashboard.js");
}, function (error) {
console.warn("Unable to load dashboard.js");
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment