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

  • Home
  • SEARCH
  • 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 6124415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:07:49+00:00 2026-05-23T16:07:49+00:00

Is there a way to have some code run in the browser after coffeescript

  • 0

Is there a way to have some code run in the browser after coffeescript has compiled and run all the script files in the header?
Something like:

coffee.onCompiled () -> console.log “I’ve finished loading all the coffee files”

How else can I get this behaviour? (please don’t suggest setTimeout)

  • 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-05-23T16:07:49+00:00Added an answer on May 23, 2026 at 4:07 pm

    At first I thought you were asking about how to attach a callback to window.onload from CoffeeScript (which is, of course, very straightforward, since “It’s just JavaScript”), but now I realize that you’re asking how you ensure that code runs after all

    <script type="text/coffeescript" src="..."></script>
    

    tags have been executed when using coffee-script.js.

    One solution is to put a callback in the last CoffeeScript you load. Since 1.1.0, coffee-script.js has ensured that all CoffeeScript script tags are run in order (though note that they’ll only run after all JavaScript script tags have run). So, for instance, if you put

    <script type="text/coffeescript">
      onReady()
    </script>
    

    after all your other script tags, and define window.onReady somewhere else, then that function will be called after all scripts have loaded. If you made it

     $ -> onReady()
    

    (with jQuery), then you’d ensure that the DOM is ready as well as all scripts.

    Update: I posted that this is “one solution” because I wasn’t 100% sure whether there’s a callback that coffee-script.js invokes after all scripts have been run. But after checking the source, I can confidently say that it doesn’t, so the only solution is to put code in the last <script type="text/coffeescript"> tag. (Whether it’s inline or in a .coffee file doesn’t matter.)

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

Sidebar

Related Questions

I have some code to read from a pdf file. Is there a way
Is there a way to have some kind of default constructor (like a C++
I have some VirtualBox VMs running. Is there any way to programatically get the
Is there a way to use Bluetooth from the iPhone SDK? I have some
Is there some way to have the Mail Merge capability in my application? Maybe
Is there a way to have a function return a editable reference to some
Is there some way when sending this message to specify that I rather have
Is there some way to replicate rails' link-to-unless-current? Ie. if i have a list
If I have an NSArray with some values in them. Is there a way
I have a asp.net mvc application. Some pages require SSL, is there a way

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.