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 6242555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:58:38+00:00 2026-05-24T11:58:38+00:00

I am trying to get jsdoc to automatically generate when I save my javascript

  • 0

I am trying to get jsdoc to automatically generate when I save my javascript file. I have got a working script that stores the last update time of a file (currently hardcoded) and compares with the current timestamp of that file. I run this in a while loop that runs until CTRL-C is pressed, and insert a 0.1 second sleep to stop the processor being consumed.

This is the working script:

while :
do

if [ $(( lastTime )) -ne `stat -f %m -t %s javascript.js` ]
then
        lastTime=`stat -f %m -t %s javascript.js`
        # custom jsdoc generating script
        jsdoc javascript.js
        echo +++ Run: `date`  +++
fi

# stops while loop from consuming a lot of resources
# and making my fan whirr like he wants the computer to take off
sleep .1

done

I know there is a better way – just not what that way is. Any help appreciated.

Edit: Update for linux machines with inotify-tools installed this should work

#!/bin/bash

# with inotify-tools installed...

# only watches first parameter for modification
while inotifywait -e modify $1; do
        echo
        echo +++ Building JSDocs +++
        jsdoc $@
        echo +++ Last run: `date`  +++
done

However, I would like this to work on both Linux and OSX shell, so I can use in both environments

  • 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-24T11:58:39+00:00Added an answer on May 24, 2026 at 11:58 am

    There is a linux kernel feature called INotify that watches the file system for any changes. It is exposed as a number of system APIs.

    For scripting, there is a package called inotify-tools that gives scripting access to the notification system.

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

Sidebar

Related Questions

I am trying to get a bash script that generates JSDoc for given parameters
Trying to get comfortable with jQuery and I have encountered some sample code that
Trying to get all articles, with unique titles (distinct(title)), that have a body of
I am trying get a div that I have hidden to show in the
Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get
Hello everyone I been trying get php uploader working but having a lot of
Trying to get zeroclipboard positioned properly, and things aren't working quite as expected, even
Trying to: get all users by using the query in the below script into
I am trying get Javascript popup calendar control to work which doesnt work. I
I am trying get my first simple project in rails to run. I have

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.