more G-Labs products

Author Topic: JavaScript API or Reference  (Read 3297 times)

April 20, 2015, 10:38:49 AM
Read 3297 times

Ossi_Jr

  • *
  • Information
  • Newbie
  • Posts: 8
Hi,

is there a documentation about programming in HomeGenie with JavaScript? Like how to access nodes, set certain values on nodes, etc?
An API or reference document would be awesome. All example programs currently available are in C# only, nothing in JS.

Cheers
« Last Edit: April 20, 2015, 10:49:02 AM by Ossi_Jr »

April 20, 2015, 05:27:55 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
As far as I know, the only language that is documented is C#.  There are some examples on the forum of JS and Python, but I have never seen anything that says how to change the C# commands to be compatible with other languages.

April 22, 2015, 11:38:06 AM
Reply #2

Ossi_Jr

  • *
  • Information
  • Newbie
  • Posts: 8
Strange that HG says it is supporting JS but there is no documentation whatsoever. Not user friendly at all, unfortunately.

April 22, 2015, 05:00:42 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Gene is a one man show and he added JS, Python, etc scripting all at once.  At the same time, he was busy documenting the C# functionality, which is now pretty good.  I'd agree that having a reference would be helpful for the other languages, though.  When I started working with HG there was no C# reference either and it was painful to use the existing scripts as a guide since everything was not covered.  Unfortunately, I don't know those other languages beyond a couple short classes taken years ago.  Either way, I'm sure you need the reference for specific commands so my minimal experience wouldn't help anyway.  My suggestion would be to file a feature request to get documentation added for those other languages.

April 22, 2015, 07:57:49 PM
Reply #4

Ossi_Jr

  • *
  • Information
  • Newbie
  • Posts: 8
Sounds absolutely reasonable. I highly appreciate the work of Gene as HG is such a promising alternative. But missing documentation can lead potential users away from HG.

Ib will try to go for the feature request.

May 02, 2015, 12:07:10 PM
Reply #5

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Documentation is something that will be improved with time. By the way, there's not much to say about HG's Javascript programming than just Javascript programming itself. The only difference is that Helper Classes have to be called by using the hg.  prefix.

For example, when in a C# app you see something like:

Code: [Select]
Program.Say("Hello world!", "en-US");
Program.Pause(1);

the equivalent in Javascript would be:

Code: [Select]
hg.Program.Say('Hello world!', 'en-US');
hg.Program.Pause(1);

Hope this helps for getting started. Feel free to ask if you need more specific examples.
Some useful links:


Cheers,
g.
« Last Edit: May 02, 2015, 12:14:57 PM by Gene »