Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define(function() {
- // Configuration of RequireJS
- requirejs.config({
- // No module can start with require. This can potentially allow easier definition of some elements
- enforceDefine : true,
- map : {
- '*': {
- 'jquery': 'libs/jquery',
- },
- // To make jquery work with requireJS: see http://requirejs.org/docs/jquery.html
- // 'jquery' wants the real jQuery module
- // though. If this line was not here, there would
- // be an unresolvable cyclic dependency.
- 'libs/jquery': { 'jquery': 'jquery' },
- },
- // The base URL is just the top-level directory where the files are stored
- baseUrl : './',
- // Kick-start the application by loading these files
- deps : [ 'MyMainPanel' ],
- });
- });
- define(['jquery'], function (jq) {
- return jq.noConflict( true );
- });
- ...
- <dependency>
- <groupId>org.webjars</groupId>
- <artifactId>jquery</artifactId>
- <version>${jquery.version}</version>
- </dependency>
- ...
- GET http://localhost:8080/jquery.js 404 (Not Found)
- require.js:166 Uncaught Error: Script error for: jquery
- http://requirejs.org/docs/errors.html#scripterror
- define(['ractive',
- 'jquery',
- function(Ractive,
- $,
- ){
- var Panel = Ractive.extend({
- el:"mainPanel",
- oninit: function(){
- $.ajax({url: "/myURL"}).done(function(types){
- // Work
- })
- }
- })
- return Panel
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement