Comments (6)
Sure @leif81. I'll do the needful changes and send you a PR.
from open-dis-javascript.
I created a PR for adding var
.
However the PR does not contain a fix for the issue of compiler not recognising the module (the need to add // @ts-config
). In order to fix that we are required to introduce a ts file declaring the exported functions and variables with their types. It would not interfere with existing behaviour for nodejs apps. If you want I can take a stab at it but it would take some time to create.
from open-dis-javascript.
I'm not sure myself but maybe someone in the community has some experience and will comment here.
from open-dis-javascript.
For my angular app I installed the latest version of the module with no issues.
npm install open-dis --save
However I kept getting the error dis is not defined
in the console when I tried to use the module. After quite some tinkering and experimenting I managed to get it to work for my app. However I had to modify the module (dist/dis6.min.js or dist/dis7.min.js) as follows.
Since the variable dis
was not properly declared, I inserted the var
keyword.
if(typeof dis==="undefined")dis={};
to
if(typeof dis==="undefined")var dis={};
And in my app component pages instead of using require
I used import
instead.
eg:
// @ts-ignore
import {PduFactory} from 'open-dis'
Note: Had to add // @ts-ignore
because the compiler seems to not able to locate the module although it's available during runtime.
If this looks like the way to go, I'd appreciate someone from the developer team updating the code and publishing a new version so that I can directly use the one in the npm registry without needing to modify it.
thanks in advance.
from open-dis-javascript.
Thank-you @samindaw
The proposed change makes sense to me. Would you be able to submit a pull request for the change?
from open-dis-javascript.
Thank-you @samindaw
I've merged the var fix.
Yes, go ahead and create a second PR for the typescript header it sounds like a useful improvement to include here.
from open-dis-javascript.
Related Issues (15)
- Importing open-dis on browser: [plugin:vite:import-analysis] Failed to resolve entry for package "open-dis". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "open-dis". The package may have incorrect main/module/exports specified in its package.json. HOT 6
- EntityMarking seems unimplemented HOT 2
- Chunk functions are different than ones used throughout the repo HOT 4
- DIS 6 Variable Datum and Chunk are broken HOT 1
- Handling of DataPDUs HOT 3
- EntityMarking: characters array length is wrong HOT 2
- Support for DIS 7 Electronic Emissions Systems HOT 2
- Enable use of DIS 6 and DIS 7 in same library
- Integrating ES6/TypeScript HOT 1
- Merge Transmitter and Signal PDU branches
- Issues calling DISPduToBuffer on TransmitterPDU HOT 4
- Javascript Dead Reckoning HOT 3
- "Offset is outside the bounds of the DataView" for Data and Event PDUs HOT 3
- Push New Version to npm? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open-dis-javascript.