Are there JSDoc files for Firefox XPCOM? - javascript

While I know much of XPCOM is implemented in C++, it would still be great to have JavaScript stubs with empty functions, constants, and JSDoc. These could be used to support code completion, inspection, quick doc, and other features of IDEs like WebStorm (IntelliJ).
It would be great if this just existed somewhere (but I haven't found it). Another approach would be to try and generate them from the IDL, but I haven't found a a way to do that either. I have question on that at Are there JSDoc files for Firefox XPCOM?.

I wrote a PHP script once, which generates PHP stubs from PHPDoc available at http://www.php.net for providing code assist in Eclipse PDT. You can use similar approach to generate JSDoc from XPCOM Doxygen.

Related

JS code obfuscation in netbean [duplicate]

Are there any known Plugins or ways to properly autoformat Javascript in Netbeans IDE?
EDIT 9/15/2012
After looking into this further, I have found that the javascript module is being rewritten already(much needed). You can finally find formatting options for javascript. It's available in the netbeans nightly builds. Good luck all.
http://bits.netbeans.org/download/trunk/nightly/
I have released a pretty simple JS formatter that uses JSBeautify and runs in Rhino.
http://plugins.netbeans.org/plugin/43263/jsbeautify
You have to use an alternate key for now. I'm working on modifying the Javascript language in Netbeans to possibly release something better, later on(either as a plugin or patch). I'm still familiarizing myself with the way things are happening in Netbeans.
There have been talks for years to add more formatting options for Javascript in Netbeans. Nothing has surfaced. I'm going to propose that the Javascript language leverage JSBeautify(running in Rhino) to provide formatting, rather then implementing new features in Java. This simplifies the formatting process, plus the JSBeautify community is very large and it's actively developed.

Compiling Dart into minifier friendly javascript: From dartdevc into google-closure-compiler

What compiler options are best to ensure that dartdevc generates minifier friendly javascript code which can be compressed by google closure compiler in ADVANCED mode.
Please show a tested example that specifies options for 1. dartdevc, and 2. java -jar goolge-closure-compiler.jar as a simple bash script, without pub.
Module type should be 'common' if possible, dart_sdk.js should be included, the final result should be es3 or es5 for compatibility with all browsers, and all output goes into one compressed .js file.
The dartdevc compiler is not meant for production usage at this time, and does not support any sort of "advanced" optimizations (such as those done by the Google Closure Compiler). Our only supported optimization path is using dart2js, our optimizing compiler which in many cases is as good as or better the Google Closure Compiler.
See "When should I use dartdevc" on our FAQ page:
Use dartdevc whenever you’re actively working on your code.
Keep using dart2js to build your deployed, production application. With dart2js you get advanced optimizations such as tree shaking to minimize downloaded code size.
I'm excited you'd like to see dartdevc work for more use cases, but we are concentrating on a great developer experience and keeping optimization usage in dart2js at this time.

Code formatting standard across various IDEs for JavaScript

I am working on an Angular project. Developers in my team are using various IDEs like WebStrorm, SublimeText or even Eclipse.
I wish to have some kind of code formatting rules defined for JavaScript defined which can be imported in WebStorm as well as other IDEs, but as I searched I could not found anything standard for this.
How can I do this?
You can use a plugin called editorconfig. It supports all the major editors. You define the rules in a config file that sits in the root of the project repo.
Additionally, you can include jsHint in your workflow/build process to check your code for potentially problems and inconsistent formatting. It's fully configurable.

What tools other than jslint exist to validate and check Javascript syntax and style?

In our current project we are using JSLint for verifying that Javacript is written correctly, and that it satisfies a few style checks. This is included as an Ant task in our build.xml.
However, I have found that the license of JSLint makes it incompatible with free and open-source software:
// The Software shall be used for Good, not Evil.
I also find JSLint a bit too overzealous in its checks, and makes JQuery-based development difficult. I understand that its intent is not to help one develop scripts, but to check that the script will work in most existing language implementations.
Finally, it's just not smart enough with its scoping: what's wrong with defining a variable in the head of a for loop? (i.e. for (var i = 0; ...) rather than var i; for (i = 0; ...)).
(EDIT: This is actually a problem with Javascript itself. JavaScript does not have block scope, unlike most C-like languages.)
What alternatives exist for verifying the syntax and style for Javascript scripts, intended to be executed within modern web browsers? Any implementation language is fine. I've even thought about using the Rhino library to load and execute the script within Java.
Use JSHint: http://www.jshint.com/
Why not try TypeScript? its much better than any "checker" JS can provide and generates great code. Its also type-safe and a leaner-meaner language. Just an opinion.
JSHint does not have the same license as JSLint. In a sense it does have an MIT license without the 'Do no evil' addition of JSLint. See the github link:
jsHint license on gitHub

XPJS (Javascript XPCOM) Documentation?

Anyone know where is some usable XPJS, or XPCOM in JS, documentation for recent versions of Firefox/Gecko? And sample code/ tutorials would be great too.
I need to write my own Component, but without .IDL (no C++ compiled interface), so I could access it via
Components.classes['#com.mareksebera/compname;1']
.getService().wrappedJSObject;
or this way is not supported anymore? I can't use
Components.classes['#com.mareksebera/compname;1']
.createInstance(Components.interfaces.nsICompName);
Because of missing compiled interface nsICompName
And yes, I know that NSGetModule is deprecated, and I use NSGetFactory and XPCOMUtils.jsm
I know these, but those are not usable with up to date browsers versions
https://developer.mozilla.org/en/Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System
https://developer.mozilla.org/en/Using_XPCOM_in_JavaScript_without_leaking
https://developer.mozilla.org/en/how_to_build_an_xpcom_component_in_javascript
The third link you mentioned is pretty good. Another way to get examples though is to actually download the Mozilla source code and look in the /tests subdirectories. There are some examples there of javascript created XPCOM objects.
One example that comes to mind can be found at:
<mozilla-central>\content\xtf\test\unit
But there are a ton of examples throughout the codebase.
If you prefer you can also browse the code online via mxr.

Categories