<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-24 15:36 GMT+01:00 Victor Rubezhny <span dir="ltr"><<a href="mailto:vrubezhny@exadel.com" target="_blank">vrubezhny@exadel.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Angelo,<br>
<br>
Yes, CordovaJS plug-in certainly could and should be improved.<br>
<br>
cordova.addXXXEventHandler('xxx') methods don't return an event
object. These methods take an event name as an argument, then
create, register and return back a handler (which is a function
"fn()" - probably the only arguments could be specified here, but
I don't know how i can specify them in a return value). But they
don't return an Event object.<br></div></div></blockquote><div><br></div><div>I suggest you that you see angular.js tern plugin. There is complex case.To manage return value with tern, you can :</div><div><br></div>
<div>1) hard coded the returns value (as you have done with -> fn())</div><div>2) use -> !this if your return value is the same instance than your function property</div><div>3) use +MyType if your function must returns an instance of MyType that you have declared.</div>
<div>4) use custom!MyFunction where MyFunction is registered with infer.registerFunction("MyFunction", ...</div><div>With that you can develop your own JS logic. See angular_bind for instance.</div><div><br></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div>
<br>
There is such an object (Event) but looks like it comes from
document, so it looks like CordovaJS plug-in should depend on some
ecma5 or browser support plug-in or library. Also, I don't see a
place when the Event object is used directly in publicly declared
functions (as an argument or a return value). The pair of
arguments used: 'event' (actually a name of event) and handler
function for that event.<br></div></div></blockquote><div><br></div><div>Have you tried to use Event+ in your tern plugin? If you see jquery.json tern def, it use Element too and it is not declared in the jquery.json but in the browser.json </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div>
<br>
So, I should investigate it a bit more in order to support it
correctly.<br>
<br>
Thanks in advance,<br>
Victor<div><div class="h5"><br>
<br>
On 03/24/2014 05:22 PM, Angelo zerr wrote:<br>
</div></div></div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">Hi Victor,
<div><br>
</div>
<div>Thank's for your work.</div>
<div><br>
</div>
<div>I don't know <span style="font-family:arial,sans-serif;font-size:13px">CordovaJS,
but </span>I think you could improve this plugin by managing
type like event.</div>
<div><br>
</div>
<div>For instance : </div>
<div><br>
</div>
<div>------------------------------------------------------------------------------------------------------------------------------------------------------<br>
</div>
<div>
<div>var event = cordova.addDocumentEventHandler('xxx')
//<-Ctrl+Space shows cordova object's members:</div>
<div>event. <= Ctrl+Click open events methods.</div>
</div>
<div>------------------------------------------------------------------------------------------------------------------------------------------------------<br>
</div>
<div><br>
</div>
<div>jquery and browser tern plugin do that.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Regards Angelo<br>
<br>
<div class="gmail_quote">2014-03-21 17:11 GMT+01:00 Victor
Rubezhny <span dir="ltr"><<a href="mailto:vrubezhny@exadel.com" target="_blank">vrubezhny@exadel.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>We've pushed CordovaJS plug-in into Angelo's
repository.<br>
<br>
Wiki page:
<a href="https://github.com/angelozerr/tern.java/wiki/Tern-&-CordovaJS-support" target="_blank">https://github.com/angelozerr/tern.java/wiki/Tern-&-CordovaJS-support</a><br>
<br>
You can play a little demo on cordova object (as well
as some other variables and functions) content assist
provided by cordovajs.js Tern plug-in with Code Mirror
here:
<a href="http://codemirror-java.opensagres.eu.cloudbees.net/codemirror-javascript/demo/cordovajs.html" target="_blank">http://codemirror-java.opensagres.eu.cloudbees.net/codemirror-javascript/demo/cordovajs.html</a><br>
<br>
Regards,<br>
Victor
<div>
<div><br>
<br>
On 03/18/2014 07:30 PM, Victor Rubezhny wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite">
<div>I've updated the cordovajs plugin for
Tern/Node.js:<br>
<br>
- all global vars from cordova.js and require.js
(the Cordova's one) are listed in Content Assist<br>
- status constants defined in cordova.js are
listed in Content Assist<br>
- some global object's vars that are defined in
cordova.js/require.js are listed in Content
Assist<br>
<br>
Guys (and especially Denis and Gorkem), I'd like
you to review the plugin. <br>
<br>
It's in my branch on GitHub: <a href="https://github.com/vrubezhny/tern.java/tree/cordovajs" target="_blank">https://github.com/vrubezhny/tern.java/tree/cordovajs</a>
(currently it's rebased over agelozerr's today's
master)<br>
<br>
Have fun at EC,<br>
Victor<br>
<br>
<br>
On 03/13/2014 06:19 PM, Victor Rubezhny wrote:<br>
</div>
<blockquote type="cite"> Hi, guys!<br>
<br>
While playing with Tern I was able to make a
very simple plugin that allows to show 'cordova'
object and some of its members in Content
Assist.<br>
<br>
<img alt="" src="cid:part5.07020203.05070005@exadel.com" height="585" width="1102"><br>
<br>
This is a very first and simple script that
shows 'cordova' object and its members in
content assistant without requiring to have any
kind of cordova.js included to a project.<br>
But it requires:<br>
- to have Tern.java (updated with cordovajs.js
plugin)<br>
- to have Tern nature enabled on your project<br>
- to have cordovajs plug-in enabled in project's
Turn preferences.<br>
<br>
You can look at the code changes in my branch on
GitHub: <a href="https://github.com/vrubezhny/tern.java/tree/cordovajs" target="_blank">https://github.com/vrubezhny/tern.java/tree/cordovajs</a>
(currently it's rebased over agelozerr's master)<br>
There are no any special inference done due to
get some objects/values from the modules that
are loaded by require/define functionality. <br>
This probably will require more sophisticated
coding to be done.<br>
<br>
/Victor<br>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
jbosstools-dev mailing list
<a href="mailto:jbosstools-dev@lists.jboss.org" target="_blank">jbosstools-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/jbosstools-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/jbosstools-dev</a></pre>
</blockquote>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
jbosstools-dev mailing list
<a href="mailto:jbosstools-dev@lists.jboss.org" target="_blank">jbosstools-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/jbosstools-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/jbosstools-dev</a></pre>
</blockquote>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
jbosstools-dev mailing list<br>
<a href="mailto:jbosstools-dev@lists.jboss.org" target="_blank">jbosstools-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/jbosstools-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/jbosstools-dev</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br></div></div>