(null): Javascript null is not a function, line 1

TobyAM's icon

I'm trying to include (and use) this js script https://raw.githubusercontent.com/astrojs/fitsjs/master/lib/fits.js
but I get the above error message . This is the example code I'm trying:

include("fits.js");

var FITS = astro.FITS;
      
  // Define a callback function for when the FITS file is received
  var callback = function() {
        
    // Get the first header-dataunit containing a dataunit
    var hdu = this.getHDU();
        
    // or we can do
    var header = hdu.header;
        
    // Read a card from the header
    var bitpix = header.get('BITPIX');
        
    // Get the dataunit object
    var dataunit = hdu.data;
        
    // Do some wicked client side processing ...
}

      
  // Set path to FITS file
  var url = "/test.fits";
      
  // Initialize a new FITS File object
  var fits = new FITS(url, callback);

function bang()
{
    outlet(0,bitpix);
}

TobyAM's icon