Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9228983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:27:39+00:00 2026-06-18T05:27:39+00:00

I am working on a combination of coffeescript and require.js for AMD. The problem

  • 0

I am working on a combination of coffeescript and require.js for AMD.

The problem would be that I must return a value for each module loaded by require.js, and I do that. But.. coffeescript helps me out and appends:(function() { and }).call(this);. which blows my code.

main.js

require.config( {
    paths: {
        'backbone':         'libs/AMDbackbone-0.5.3',
        'underscore':       'libs/underscore-1.2.2',
        'text':             'libs/require/text',
        'jquery':           'libs/jquery-1.7.1',
    },
    baseUrl: '/app'
} );

require(
        ['require', 'backbone', 'jquery', 'underscore' ],
        function( require, Backbone, $, _ ) {
            // framework loaded
            require(
                    ['require', 'app'],
                    function( require, app) {
                        return {};
                    } );
        } );

app.js

define( [
    'jquery',
    'underscore',
    'backbone',
    'views/gameview',
], function( $, _, Backbone, GameView, ) {
    "use strict";

    window.app = {};

    $(function(){

        var app = window.app = _.extend({

            views: {
                GameView: new GameView
            },
            //code..
        }, window.app);

    //code...
    return window.app;
} );

And the coffeescript:

/views/gameview.coffee

define ["jquery", "underscore", "backbone"], ($, _, Backbone, RankView) ->
  "use strict"
  GameView = Backbone.View.extend()
  GameView

Which translates to:

/views/gameview.js

(function() {

  define(["jquery", "underscore", "backbone"], function($, _, Backbone) {
    "use strict";

    var GameView;
    GameView = Backbone.View.extend({...});
    return GameView;
  });

}).call(this);

But I would like to translate to:

  define(["jquery", "underscore", "backbone"], function($, _, Backbone) {
    "use strict";

    var GameView;
    GameView = Backbone.View.extend({...});
    return GameView;
  });

Would be nice to use this in console: var GameView = new app.views.GameView; in console.

How do I force coffeescript compiler not to do that? Is there a flag or something for that?

AGAIN: I JUST WANT TO CUT OFF (function() { and }).call(this); – is not that important the amd code behind it, be it global or not..

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:27:41+00:00Added an answer on June 18, 2026 at 5:27 am

    You can use the --bare flag when compiling your coffee files:

    -b, --bare Compile the JavaScript without the top-level function safety wrapper.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Matplotlib and Pylab don't work in Python CGI. But the same combination is working
Currently I am working on a problem which is implemented as a combination of
I am working on a module that supplies methods for navigating directories and manipulating
I have an autocomplete that is working for any combination of letters that you
I'm working with PyGTK, trying to come up with a combination of widgets that
I am working on Ginger Bread source code. First time compilation require 3 to
Working with an undisclosed API, I found a function that can set the number
As the title suggests, I'm trying and failing to get the following combination working
I finally got the Ws-Security working with CXF-BC & CXF-SE combination. I'm now trying
While working with Matlab I'm using very often the combination of Ctrl+A (select all)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.