Skip to content

Instantly share code, notes, and snippets.

@etobi

etobi/define Secret

Last active August 29, 2015 14:06
Show Gist options
  • Save etobi/167fbc80875e539fa333 to your computer and use it in GitHub Desktop.
Save etobi/167fbc80875e539fa333 to your computer and use it in GitHub Desktop.
define('TYPO3/CMS/StagedealFoobar/Components/Foobar', ['jquery', 'jquery-ui'], function ($) {
return function (options) {
var settings = $.extend({
foobar: 'defaultwert von foobar'
}, options);
alert(settings.foobar);
}
});
require(['jquery', 'TYPO3/CMS/StagedealFoobar/Components/Foobar'], function($, baz) {
baz({foobar:'überschreibt den defaultwert von foobar'}); // ruft die function auf, die in dem define zurückgegeben wird.
// hier hast du auch jQuery mit $ verfügbar.
// "jQuery(document).ready(function(){" brauchst du hier nicht machen
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment