0xStarcat / Moshier-Ephemeris-JS

ES6 "re-implementation" of ephemeris calculations for sun, planets, comets, asteroids and stars.
GNU General Public License v3.0
40 stars 14 forks source link

html code not working #4

Open BlogSafe opened 2 years ago

BlogSafe commented 2 years ago
    <script>
        const ephemeris = new Ephemeris({
            year: 2000, month: 0, day: 1, hours: 0, minutes: 0, latitude: 41.37, longitude: -71.1, calculateShadows: false
        })
        ephemeris.Results;
    </script>

    gives: Ephemeris is not a constructor
0xStarcat commented 2 years ago

Do you have the build bundle imported at the top?

I don't actually have a CDN hosting this file or anything, i just have it available for download through NPM. You may need to create your own script which imports it from NPM and loads it. Or you may need to copy the build script directly into your project and import it like so:

<script type='text/javascript' src='../build/ephemeris-1.2.1.bundle.js' charset='utf-8'></script>

That's where the demo html gets the Ephemeris class from https://github.com/0xStarcat/Moshier-Ephemeris-JS/blob/master/demo/index.html#L8