You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/03/06 17:53:31 UTC

[GitHub] [netbeans-html4j] jtulach opened a new pull request #44: WIP: Support asynchronous calls from JavaScript into Java

jtulach opened a new pull request #44:
URL: https://github.com/apache/netbeans-html4j/pull/44


   Adding
   ```java
   @interface JavaScriptBody {
     boolean wait4java() default true;
   }
   ```
   When set to `false` then each call into Java (via `@pkg.Clazz.method` syntax) returns (ideally real JavaScript) `Promise` with `then` method.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans-html4j] JaroslavTulach commented on a change in pull request #44: WIP: Support asynchronous calls from JavaScript into Java

Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #44:
URL: https://github.com/apache/netbeans-html4j/pull/44#discussion_r833157599



##########
File path: ko4j/src/main/java/org/netbeans/html/ko4j/Knockout.java
##########
@@ -315,8 +307,25 @@ function write(val) {
             };
             var cmpt = ko['computed'](bnd);
             cmpt['valueHasMutated'] = function(val) {
-              if (arguments.length === 1) activeGetter = function() { return val; };
-              trigger(val);
+              if (arguments.length === 1) {
+                value = val;
+                trigger(val);
+              } else {
+                var self = ret['ko4j'];
+                if (self) {
+                  var futureValue = self.@org.netbeans.html.ko4j.Knockout::getValue(I)(index);
+                  Promise.resolve(futureValue).then(function(val, e) {

Review comment:
       The whole `ko4j` bindings are now ready for `wait4java=false`, however, that means various updates may happen asynchronously. To get ready for that I had to modify the _Test Compatibility Kit_ to work in _quantums_: https://github.com/apache/netbeans-html4j/commit/1e398f86e740ba4aebef9457e0bea2dadf651b56




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists