Is there is an option somehow to bind two objects with Dart?
Two-way binding and or one-way binding?
Like JavaFX binding packages or some other systems.
Related
Sorry, this maybe a basic question. What are the difference between JNA direct mapping and interface mapping?
Is my interpretation correct:
Direct mapping: use the library object directly (like static main in Java)
Interface mapping: create an instance of the library object.
Thanks in advance!
Direct mapping directly binds your Java methods (declared with the native modifier) to native code which attempts to use the call stack as-is. Direct mapping is most effective if you restrict your function arguments and return values to primitive types (the Pointer type may be considered primitive).
The interface mapping uses a Proxy and dynamically translates Java function signatures into a generic native entry point with a list of arguments which must subsequently be translated into native primitives. It's more flexible w/r/t translating Java types to and from native, but can be much slower due to the runtime translation of arguments.
I'd like to generate a stream of events from a common Set<T> object in dart so that I am informed whenever any T is added or removed. Is there anything like that already available in the core dart libraries or one of its packages?
There are observable list and map in https://pub.dartlang.org/packages/observe.
Is there a way to set up bindings imperatively. An example use case:
var el2 = new MyElement();
el2.myProp = this.$.anotherElement.anotherProp
That won't setup a binding, it just assigns the value or object. I'd like to find a way to do something like:
el2.myProp.bindTo(this.$.anotherElement.anotherProp)
Possible?
Polymer 1.0 does not support this at the moment - as explained by #kevinpschaaf in Github https://github.com/Polymer/polymer/issues/1778.
(comment by #kevinpschaaf)
No, we don't currently support this, outside of dom-bind, which is the
only template implementation that late-binds instance children. You
can document.createElement('template', 'dom-bind'), then you can
dynamically append children with binding annotations to its content,
and the bindings will only be evaluated once the dom-bind is attached
to the document. See tests here that show this usage of it:
https://github.com/Polymer/polymer/blob/master/test/unit/dom-bind.html#L95
Note that dom-bind does not currently allow binding to outer scope, so
it has limited use in custom element templates (it's main use case is
for binding between elements in the main document), and that's not
likely to change short-term.
We are achieving a lot of performance optimization by baking the
binding connections into the prototype at registration time for an
element (rather than at instance time), and we haven't built up enough
of the machinery to easily allow runtime addition/removal of bindings.
I have a Delphi VCL application that manipulates a TClientDataset object. I need to pass this object as a parameter to a custom COM library, also written in Delphi.
I have two questions:
1) Is this possible?
2) If so, how?
No you cannot pass such an object. It is not a valid COM interop type. In fact you cannot even pass such an object between Delphi modules other than runtime packages.
The most obvious solutions are:
Wrap the object with a COM interface and pass that. The interface would have to expose methods to extract the data.
Serialize the data, for instance as JSON, and pass that as text. On the other side you would need to de-serialize.
Use the built in serialization capabilities as offered by the Data and XMLData properties of client data set.
The latter two serialization based options are probably simpler. But more costly in terms of memory. Using an interface requires more work to code, but may result in more efficient runtime performance.
I have defined some custom knockout observable functions as documented on the knockout site here: http://knockoutjs.com/documentation/fn.html. Breeze seems to be burying the custom functions deeper inside the object hierarchy. For instance ko.observable.fn.myCustomFunction ends up appearing at entity.someProperty.ko_proto.__ko_proto__.fn.myCustomFunction instead of at entity.someProperty.myCustomFunction as expected.
How can I reliably access my custom knockout functions on breeze entities?
You can solve the problem yourself on a spot basis, by attaching a custom function to entity.someProperty that delegates to entity.someProperty.ko_proto.__ko_proto__.fn....
I bet you have to attach the function for each instance of the entity. I think the best place to do this is in a custom EntityType initializer.
The Knockout documentation recommends that you use custom KO functions sparingly. It says so several times. So the proposed workaround should be only a minor inconvenience.