Book a Demo

Author Topic: Javascript Model AddIn - Including Libraries  (Read 382 times)

EAButNotForGames

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Javascript Model AddIn - Including Libraries
« on: June 09, 2026, 08:25:44 pm »
I am currently trying out the Javascript Model Addins and I got a problem with the inclusion of libraries.
So looking at the example a dependency connection and putting the class in the utilities package should have been enough.

But when I try to call them, I get:
  34:            var doc = new JSxml();             [!!!! JSxml is not defined]
  35:            doc.SetCurrentNode(doc.CreateRootElement("properties"));

In this video on the sparx youtube chanel: https://www.youtube.com/watch?v=n9tWUncuVGo
They claim this works.

Am I missing something or is this just a buggy feature?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Javascript Model AddIn - Including Libraries
« Reply #1 on: June 10, 2026, 09:23:18 am »
For clarity, I'm not familiar with that EA Global Summit presentation or any framework that the presentation references. I can only comment on the Model Add-In functionality itself.

Yes, you can add a Dependency from your «JavascriptAddin» to another class that contains additional code to be able to reference that class. The reference to a utilities package makes me worry that you've added a dependency to a package instead, but I can't see your model. I suspect the utilities package is the way the presenter like to organize his model.

EAButNotForGames

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: Javascript Model AddIn - Including Libraries
« Reply #2 on: June 10, 2026, 03:31:36 pm »
Thanks for you answer.
The reference is to the class element and not the package.
And the Utiliies package is used in the EAExample model in the package "Model Based Add-Ins"
I am building a model addin using the same structure.

After testing, it seems that the example is also not functional.
The AddIn "MyDemoAddin" has the reference to 2 class elements, but the operations calling them (TestOtherObject, TestXML) is not implemented.
After adding them:



they throw the same error:

Code: [Select]
Invocation error in: addin.EA_MenuClick
------------------------------------------------
 344:    }
 345:    MyDemoAddin.prototype.TestXML = function() {
 346:    var doc = new JSxml();
 347:    doc.SetCurrentNode(doc.CreateRootElement("properties"));             [!!!! JSxml is not defined]
 348:    var group = doc.AppendChild("group","");
 349:    doc.SetAttribute(group, "name", "theGroup1");
 350:    this.MultiLineOutput(doc.GetXML());
 351:    }
 352:    MyDemoAddin.prototype.UpdateSelectionSummary = function(Repository) {