mirror of
https://github.com/acamarata/solar-spa.git
synced 2026-07-03 04:10:41 +00:00
Added Typescript support and path for WASM file
This commit is contained in:
parent
f10c64c5f1
commit
35b1cedc4a
3 changed files with 29 additions and 1 deletions
21
index.d.ts
vendored
Normal file
21
index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
// index.d.ts
|
||||||
|
declare module 'solar-spa' {
|
||||||
|
export default function spa(
|
||||||
|
date: Date,
|
||||||
|
latitude: number,
|
||||||
|
longitude: number,
|
||||||
|
elevation?: number,
|
||||||
|
temperature?: number,
|
||||||
|
pressure?: number,
|
||||||
|
refraction?: number
|
||||||
|
): Promise<{
|
||||||
|
zenith: number;
|
||||||
|
azimuth: number;
|
||||||
|
incidence: number;
|
||||||
|
sunrise: number;
|
||||||
|
sunset: number;
|
||||||
|
solar_noon: number;
|
||||||
|
sun_transit_alt: number;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "solar-spa",
|
"name": "solar-spa",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"description": "NREL Solar Position Algorithm (SPA) in WebAssembly",
|
"description": "NREL Solar Position Algorithm (SPA) in WebAssembly",
|
||||||
"main": "solar-spa.js",
|
"main": "solar-spa.js",
|
||||||
|
"types": "index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node test.js"
|
"test": "node test.js"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
|
// solar-spa.js
|
||||||
|
const path = require('path');
|
||||||
const spaModule = require('./spa.js');
|
const spaModule = require('./spa.js');
|
||||||
|
|
||||||
|
// Set the wasm file path
|
||||||
|
spaModule.locateFile = (filename) => {
|
||||||
|
return path.join(__dirname, filename);
|
||||||
|
};
|
||||||
module.exports = function spa(
|
module.exports = function spa(
|
||||||
date,
|
date,
|
||||||
latitude,
|
latitude,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue