Using javascript library in Dart - dart

I try to use JavaScript library visjs.org in Dart. I prepared ‘adapter’ code according examples on Dart site pub.dartlang.org/packages/js and github.com/google/chartjs.dart/blob/master/lib/chartjs.dart.
Also according basic use case example from http://visjs.org I prepare client dart code.
While code compiles without any errors and warnings nothing happens in browser, expected to see graph-tree.
What I did wrong or miss to do?
https://gist.github.com/EdSv/e274a4d12ad3491c383fb4fe76ee671e

The attribute #anonymous is meant to be used when the object you're describing doesn't actually exist in the JS library you're binding, and is only used as a plain old data object. By adding it to all of your objects, my guess is that dart is never attempting to create anything from the visjs library.
Try removing the #anonymous from your Network class and see if that has an effect. You will likely also need to make these abstract classes as well.

Related

flow error for Highcharts

I've added module highcharts in Flow project as it is written over here. Basically the problem is that whenever I use library Highcharts , I have to put into the code import Highcharts from "highcharts"; The results outcome with no errors in FlowJs interface, but with error in browser Unexpected token import( so it doesn't compile js file properly) . Does anyone know the answer for that? I would be appreciated!
Flow in general uses nonstandard syntax for type annotations, etc. In your case, the import is standard ES6 syntax, but it's not yet supported in whatever browser you are using.
Either way, the solution is to use Babel to transpile your code. You can configure it to target older versions of JavaScript and to strip Flow types. There's a bit more info about using it with Flow on the Running Flow code page.

Angular.Dart javascript interop error

I have problem with my code which is using 3rd party library. When I use it in the plain Dart itself it already works, but not with Angular.Dart. I have used chapter3 from Dart tutorial and just added my code in recipe_book.dart which is compoment.
Place where the code fails is shown in the picture below. After i get
Breaking on exception: object must be an Node, ArrayBuffer, Blob, ImageData, or IDBKeyRange
I don't have idea how to get rid of this:-( Maybe it is something somebody more familiar with Angulart.dart can answer right away.
Anybody willing to help can check the code here on github
The debugger shows it is already a JsObject, just omit the new JsObject(...) call.

Dart, how to parse user string into functional dart code?

is it possible to parse in a user entered string, say from a text area, and then incorporate it into a dart function which you can then run, without having to post it back to the server? I guess I'm looking for a dart eval equivalent.
There is no notion of eval in Dart, and it is not possible to dynamically build code. You can run code in a different isolate using spawnUri (see http://api.dartlang.org/docs/releases/latest/dart_isolate.html). When not running in the Dartium browser, note that the Dart code needs to be compiled to JavaScript using dart2js. The site http://try.dartlang.org/ does all that.
Some time in the future Dart might get mirror builders which can be used for "programs to extend and modify themselves" (citation from last paragraph in https://www.dartlang.org/articles/reflection-with-mirrors/).

Axis2 problems with Inheritence

We have object inheritance in our java classes and in the operations we are returning the base classes. Upon running Java2WSDL we noticed that only the base class object is created in the WSDL and the derived classes are completely ignored. There was no straight-forward way to handle this so we used the "extra classes" option in Java2WSDL and got the classes going. So now the WSDL looks complete.
When the client uses the WSDL (generated above) it is able to get the derived classes but when it passes them the service the service doesn't instantiate the corresponding derived class but instance always instantiates the base class, though the soap message contains the reference to the derived class. What I notice from here is it looks like the service is missing those bindings.
How do I fix this problem? Any help would be greatly appreciated.
I am obviously not a Pro with Axis, but what you try to achieve looks quite like this item in the docs:
http://axis.apache.org/axis2/java/core/docs/adb/adb-advanced.html#typeSupport
Also, you should state what serialization framework you use for your question to be complete.

Why is WSCript object not known to my script that's controlled by a custom IScriptControl?

I am using someone else's library that provides its own scripting host instance, it appears.
This lib provides me with functions to define the type of scripting language such as "jscript" and "vbscript", and I can supply it with script code and have that executed, with passing arguments in and back. So, basically, it works.
However, when I try to access the "WScript" object, I get an exception saying that this keyword is undefined.
The developer, not knowing much about this either (he only made this lib for me because I do not want to deal with Windows SDKs right now), told me that he is using "IScriptControl" for this.
Oh, and the lib also provides flags to allow "only safe subset" and "allow UI", which I set to false and true, respectively.
Does that ring a bell with anyone? Do a user of IScriptControl have to take extra steps in order to make a WScript object available? Or, can he use IScriptControl in a way that this is supplied automatically, just as when running the same script from wscript.exe?
Basically, all I need is the WScript.CreateObject function in order to access another app's API via COM.
I don't know why WScript is not known, but I suspect it is because the script host doesn't provide it. Maybe only wscript.exe does this.
If you are using Javascript, to create an object you can use new ActiveXObject(). If you are using VBScript, you can just use CreateObject.
See this article for some background.

Resources