Reflect.js, What is it? - javascript

Github repo says:
Implementation of Mozilla's Parser API in JavaScript. There are few examples on github and mozilla's reference link. I have seen this library being used in one of Angular 2 seed project as well.
But what is the use of this library? Can someone explain in easy words to elaborate purpose/advantage of this library.
Thanks

It is literally just a javascript shell, much like node you can use it to write JS interactively in the shell or run JS files with it.
SpiderMonkey is Mozilla's JavaScript engine written in C/C++.
Parser, is a JS API version of that, you can use it to write tools that manipulate JS files, like a linter or compiler.
Reflect is a super old version of that which, as far as I know, is not a viable option given the other tools we have today. Note that the repo was last updated in 2012, and the JS is only ES3 compliant.

Related

Haxe externs for JS libraries

Does there exist any central place where all Haxe bindings for JS libraries are meant to be stored? Both if I want to find one, or submit one.
Is there some not outdated working tool to generate these bindings from TypeScript definitions?
Is there a binding for nodejs ws library?
http://lib.haxe.org also known as haxelib, the Haxe package manager. Other than that there are also libraries on Github, which you can install with haxelib git libname https://github.com/bla/bla.git
This kinda sounds like all libs are out of date. There is https://github.com/Simn/ts2hx as you might understand it is not a simple task to create such tool since TypeScript is a different (more dynamic) language and has a different type system which doesnt easily translate to haxe externs. In my experience this lib does 90% of the work. Also it isnt hard to create own externs, but I get you expect free direct-use libs. If tool/lib doesnt work please repot or contribute at the lib; Thats how opensource projects work.
I dont know
Hope this helps! Have a nice day!
Besides Haxelib, you can usually find a ton of stuff on GitHub (e.g. by searching for jsrequire <foo> language:haxe or other keywords). There are also some privately curated extern collections like clemos/js-kit, haxe-node-modules, abedev/npm
Simn/ts2hx is the only one that comes to mind
I found some externs, some of them inside other projects/libraries

VIM Semantic JavaScript completion with YouCompleteMe?

is there any way to get semantic javascript code completion in VIM?
I've tried YouCompleteMe (YCM) and it gives me some code completion, however it is purely based upon my current buffer (or buffers?).
When I explicitly call :YcmCompleter, I get
ValueError: No semantic completer exists for filetypes: ['javascript']
I'm mostly working in node:sails.js and angularjs. I'd really appreciate a way of getting library methods suggested while typing (e.g. for angular, protractor / mocha / jasmine).
Thanks!
From YCm's huge README:
YCM will use your omnifunc (see :h omnifunc in Vim) as a source for semantic completions if it does not have a native semantic completion engine for your file's filetype. Vim comes with okayish omnifuncs for various languages like Ruby, PHP etc. It depends on the language.
Tern for Vim provides the kind of completion you are looking for via Vim's native omni-completion (<C-x><C-o>). With that plugin installed, YCM should be able to use it transparently for JavaScript completion.
These answers being very outdated, and since I've struggle a little bit with it, here is an update:
Javascript semantic support in Vim with YouCompleteMe is now supported via TSServer engine as explained in Ycm's HUGE readme
I've got the information thanks to : https://medium.com/parallel-thinking/actually-great-vim-javascript-completion-eaefa1cb443d
At the moment there is no semantic completer for javascript available in YouCompleteMe. However, people are working on that. Here is the pending pull request for integrating JS Tern.
Without semantic completer available you are indeed limited to language agnostic completers, such as the identifier completer, filepath completer and snippet completer.
UPDATE: Tern has been integrated into YCM

Using FTGL with Emscripten

I am trying to build a project(logstalgia) with emscripten, but the project requires the ftgl dev libraries (libftgl-dev). I have been searching around for the correct way to link this library so I can run shell> emconfigure logstalgia/configure, but I can't figure out how to compile and link this library into the project.
I have read the emscripten documentation, but unfortunately it has been years since I have used gcc or written a makefile.
Emscripten says "Other libraries not included with emscripten, like boost, you would need to compile yourself and link with your program, just as if they were a module in your project." Unfortunately I do not have enough previous knowledge to know what this wants me to do. I understand the concept but have no idea how to go about executing this. Any help would be appreciated.
You will need to build FTGL with Emscripten first, then link your application with the library your built.
But as other mentioned, first you need to check if FTGL supports OpenGL ES 2.0 since WebGL 1.0 is the same as targeting GLES2.
If not, you can always try the experimental WebGL 2.0 support, which is the same as targeting Open GL ES 3.0.

How do you attach JSdoc in Eclipse so that I can have autocomplete for a personal library

I have a JavaScript library that I am working on currently. I have structured it into lots of files and I use the module approach to define each 'module'.
var ns = generateNamespace("me.mycompany.mypackage.MyFile");
(function (ns, undefined) {
// some module
}(ns));
The modules are dynamically named using a namespacing function meaning that autocomplete is almost impossible as things stand (unless Eclipse can run my code and figure out the namespaces, Visual Studio can!).
Therefore I intend to generate JSdoc for my project in the hope that if I include this into Eclipse (somehow) Eclipse can use this to give me content assist.
Firstly I do not know if this is possible... however I think that it is as I can see that it is maybe how this works? However I tried to follow this along and struggled to get something working, by this I mean it didn't work. The interesting info from the link:
"JSDT libraries are collections of JavaScript source files that have prototyped object/class definitions and JSDoc. The inference engine then models these libraries... making them available to every JavaScript file in the project... Bindings for nonstandard and future runtimes are similarly easy to create... add the... library to their project and gain content completion and hover help"
I know how to write JSdoc annotations and I know how to generate JSdoc using one of the various tools.
What I need therefore is instructions on how to include JSdoc (as a library maybe) in Eclipse so that it will give auto complete for the stuff in the JSdoc.
Previous answer:
You can also run jsdoc_toolkit from within eclipse by setting up Run -
> External Tools -> Open External Tools Dialog...
Location
C:\Program Files\Java\jre1.5.0_12\bin\java.exe
Working Directory
C:\DirectoryToWhereJsDocToolkitIsLocated\jsdoc_toolkit
Arguments
-jar app/js.jar app/run.js -r=4 -t=templates/htm "-d=C:
\PathToWhereDocIsSaved" "C:\PathToWebsiteToDocument"
For more about the arguments check the jsdoc_toolkit documentation.
Have fun
Simon
Taken from this Google Groups thread.
Updated Answer:
Eclipse JavaScript Editor: content assist for js files, autocompletion
Disclaimer, I'm the author of tern.java.
I suggest you that you install tern.java. It provides a JSDoc support. Once you have selected this support, you can benefit
with completion :
and soon with validation:
This support is not perfect but it starts working.
I am not using it by myself, so I'm not sure if it works, but there exists a grunt-plugin for jsdoc3. Grunt is supported by Eclipse. So maybe it helps.
Grunt-PlugIn in npm

SWIG and Javascript: does embedding the JVM/Rhino into my C++ app is still the only solution?

I really like the idea of automatic binding generation like SWIG does. But it is still lacking Javascript binding. I read that it could not be done with Spidermonkey because of the JS Context that must be passed as parameter to each function.
The only solution I found is to embed a JVM into my C++ application, generating bindings to Java using SWIG, and then using Rhino engine as the JS interpreter. It works fine, but it is really heavyweight!
Any other ideas?
Note: yes I know, I could use Python or Lua instead. But my question is really about JS.
If you are not in a hurry: Wait for the SWIG Javascript bindings that might be developed as GSoC-2012 project "New module for Javascript" by Neha Narang.
The abstract says:
This project aims to add Javascript as a new supported target language
to swig to automate the generation of Javascript wrappers over C++.
The project repository is https://github.com/Neha03/gsoc2012-javascript.
Well, since I don't have any answers, I think that I must use other alternatives than SWIG.
I found that page on the mozilla developer center mentioning several projects for wrapping JS with the Spidermonkey engine: Spiderape, Flusspferd, TriXUL and jsapigen.
For V8, there is a similar project called v8-juice from the creator of Spiderape.

Categories

Resources