Created
June 19, 2014 14:57
-
-
Save dmlap/c9d54758549d36620eef to your computer and use it in GitHub Desktop.
Psuedo-code for a SmartPlayer plugin that dynamically loads another script based on information supplied by the player at runtime.
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
(function(window) { | |
'use strict'; | |
/* Collect the runtime parameters we need. In this case, we parse them out of the fragment identifier. */ | |
var params = window.location.hash.substring(1); // drop the '#' | |
/* jQuery is available for Smart Player plugins so we can use it to load our primary plugin with the parameters we just gathered */ | |
$.getScript('https://example.com/plugins/plugin.js?' + params, function() { | |
console.log('Finished loading the main plugin'); | |
}); | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment