Skip to content

Instantly share code, notes, and snippets.

@tomalex0
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save tomalex0/9838976 to your computer and use it in GitHub Desktop.

Select an option

Save tomalex0/9838976 to your computer and use it in GitHub Desktop.
Barebone script to start a javascript widget
(function(name, definition, context) {
if (typeof module != 'undefined' && module.exports) {
module.exports = definition();
} else if (typeof context['define'] == 'function' && context['define']['amd']) {
define(definition);
} else {
context[name] = definition();
}
})('myWidget', function() {
var myWidget = (function(param1, param2, param3){
console.log(param1);
console.log(param2);
});
return myWidget;
}, this);
//myWidget("firstparam", "secondparam", "thirdparam");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment