Netbeans has the ability to create an HTML5/JavaScript project.
I have written a bunch of javascript code that I would like to document. The javascript functions/classes are documented in the source code using java-style comment blocks and "standard" tags (e.g. #param).
I am looking for some way to generate an html or json document from the javascript files. For example, in Netbeans you can generate a JavaDoc via Ant. Is there something similar for a HTML5/JavaScript project?
BTW, I don't use Node.js and I don't want to install npm/node just to generate docs...
Related
Im angular developer.
In our front & back exists some magic calculation methods.
Classes same, but when anyone find bug in calculation need to fix it in two different projects.
maybe there is a way to create a generic codebase (maby function) that can be converted to js(or ts) & java and update two libraries based on the two results obtained
You could try to use kotlin.
Kotlin transpiles to JavaScript and also compiles to java bytecode.
However, you can only access kotlin utilities and neither access java or JS/TS types if you want to use the code in both java and ts/js code but you can use the kotlin stdlib.
But if it really is just a calculation, you may not need java/js specific classes/functions.
However, as VLAZ mentioned in the comments, you should consider doing the calculation only once in the backend.
Setting this up in IntelliJ
You can create such a project in IntelliJ by sekecting Kotlin in the New Project Window and using the project template Library.
Make sure you have the targets common, jvm and js. Since you didn't say you would do native stuff, you don't need the native target.
You can then use the kotlin library in both JavaScript (e.g. Angular) and Java projects as a dependency.
From a Java project, you can reference KOTLIN_PROJECT/build/classes/kotlin/jvm/main (this directory contains compiled Java classes).
From a JavaScript (e.g. Angular) project, you can reference KOTLIN_PROJECT/build/js/packages/kotlinToJavaAndJS.
As a proof of concept, I have made this repository on GitHub.
I am using Eclipse Oxygen.
I have web features already installed, I think some packages are missing for javascript files.
When I try to create a new javascript file, I see that there is no javascript file. How to add this feature into eclipse?
screenshot:
You just look in the wrong "folder" ("Web") to create a new JavaScript-file, the proper path is "JavaScript > JavaScript Source File".
You can also take advantage of the search in the Wizards when you type the desired search term at type filter text.
You must be using a perspective, which is not suitable for web development.
Try opening a perspective which suits your development domain. Web and Java EE perspectives for example supports JavaScript development. If such is not available in you Eclipse installation, you have to install additional tools. Which Eclipse package are you using?
In the right perspective you will have the JavaScript Source File option in the New pop-up dialog right clicking your project or an appropriate project folder (eg. WebContent).
I'm trying to write a new library that would work in Scala.js. I have written some of the implementations of the classes and methods in Javascript. How do I set it up so that a user can code in Scala.js (Scala)?
I've looked at some Scala.js libraries on GitHub, but these do not show the Javascript code; they all appear to be .scala files.
So how does one actually create a new library for Scala.js?
Edit: The main code for the library must be written in Javascript since it takes advantage of the Javascript audio api.
Somewhat agreeing with the comment from #sjrd, it should be possible to write your JavaScript-targeted API directly within Scala.js (See Calling JavaScript from Scala.js ).
Alternatively, there may also be the possibility for 'importing' or converting your existing JavaScript code into Scala.js '.scala' files in a strongly-typed-Scala manner, so:
Convert your JavaScript file to TypeScript, start by changing the file extension from '.js' to '.ts'.
Process your TypeScript file(s)
created in #1 into valid Scala[JS] files using #sjrd's (!) TypeScript-to-ScalaJS
importer # Github.
Finally, develop your code against Scala.js, using the '.scala'
files generated in #2
As TypeScript is a strongly-typed superset of JavaScript, changing the extension alone might be enough - otherwise, after running and failing step #2, you might need to refine you TypeScript'd library, this post, 'How to compile plain *.js (JavaScript) files with the TypeScript Compiler', should help with that.
The 'DefinitelyTyped' code repository # Github contains a collection of JavaScript libraries updated to TypeScript, the webaudio API is one of them (so this could be converted and used within Scala.JS using some of the process outlined above).
I haven't [yet] personally tested this myself, in anger, I'd be interested in whether you get any mileage out of this tool set/process.
Here are some extra TypeScript resources:
http://en.wikipedia.org/wiki/TypeScript
http://www.sitepen.com/blog/2013/12/31/definitive-guide-to-typescript
I have a JavaScript library that customers can use to script theire own extensions. Now since i wrote an eclipse plugin so they can use autocomplete and such features i'd like to publish this library but without the code itsself.
So only declarations and assigments should stay in the code but no real code. Is there a tool i can use to get this or do i have to write it myself?
I just recently started using Netbeans, and i have been working with javascript files, the files are becoming large, and i want the ability to group function in something like this in visual studio, actually code folding.
#region
code goes here
#endregion
After a search i found out that you could use
//<editor-fold>
</editor-fold>
http://wiki.netbeans.org/FaqCustomCodeFolds
but this does not work with .js files, as it's treated like a comment.
Please advise, how to add custom code folding in Netbean on javascript files.
Currently the custom code folding is not supported on javascript files to the current editor.
But will soon be implemented in the new editor in the official distribution of netbeans,
That allows you to edit your javascript files, with all features currently available in other programming languages.
New JavaScript Editor
But if you can not wait more, then you can download the Develoment Version of NetBeans
Implementing the new editor, without losing your current project settings.
Also you will can create your template code, for make a surround block code. Explained in this link.
And this is the new editor in test