GithubHelp home page GithubHelp logo

Comments (6)

samindaw avatar samindaw commented on September 24, 2024 1

Sure @leif81. I'll do the needful changes and send you a PR.

from open-dis-javascript.

samindaw avatar samindaw commented on September 24, 2024 1

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.

leif81 avatar leif81 commented on September 24, 2024

I'm not sure myself but maybe someone in the community has some experience and will comment here.

from open-dis-javascript.

samindaw avatar samindaw commented on September 24, 2024

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.

leif81 avatar leif81 commented on September 24, 2024

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.

leif81 avatar leif81 commented on September 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.