[TYPO3-dev] Add own require.js module in extension

Wouter Wolters mail at wouterwolters.nl
Mon Jul 13 13:37:34 CEST 2015


Hi Philipp,

Offcourse that is possible.

See below an example:

File should be placed in Resources/Public/JavaScript/Module.js
Include can be done in the be.container ViewHelper

includeRequireJsModules="{
	0: 'YourPlugin/Name/Module'
}"

Or use the PageRenderer class to add the RequireJS module.

Regards,

Wouter Wolters
TYPO3 CMS Active Contributor

/*
  * This file is part of the TYPO3 CMS project.
  *
  * It is free software; you can redistribute it and/or modify it under
  * the terms of the GNU General Public License, either version 2
  * of the License, or any later version.
  *
  * For the full copyright and license information, please read the
  * LICENSE.txt file that was distributed with this source code.
  *
  * The TYPO3 project - inspiring people to share!
  */

/**
  * Contactmanager main JavaScript for Backend Module
  */
define('YourPlugin/Name/Module', ['jquery', 'datatables'], function($) {

     var Module = {};

     // Initialize dataTables
     Module.initializeDataTables = function() {
         $('#addresslist').DataTable();
     };

     $(document).ready(function() {
         // Initialize the view
         Module.initializeDataTables();
     });

});

Op 13-7-2015 13:25, Philipp Wrann schreef:
>
> I tried but its allways loaded from TYPO3.CMS Namespace.




More information about the TYPO3-dev mailing list