From 72c0f66e2aa588acbb517e6d9b482c7a75faf9f1 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Thu, 14 Jun 2012 21:18:49 +0300 Subject: Use callbacks directly as fields in connector object (#8888) --- WebContent/statictestfiles/jsconnector.js | 1 + WebContent/statictestfiles/jsextension.js | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'WebContent') diff --git a/WebContent/statictestfiles/jsconnector.js b/WebContent/statictestfiles/jsconnector.js index 1432c20698..e08c748aa6 100644 --- a/WebContent/statictestfiles/jsconnector.js +++ b/WebContent/statictestfiles/jsconnector.js @@ -5,6 +5,7 @@ window.com_vaadin_tests_components_javascriptcomponent_BasicJavaScriptComponent_ rootElement.innerHTML = 'Hello world!'; rootElement.onclick = function() { connector.getRpcProxyFunction("com.vaadin.tests.components.javascriptcomponent.BasicJavaScriptComponent$ExampleClickRpc", "onClick")("message"); + connector.onclick("another message"); } connector.onStateChange = function() { console.log('state change:', this.getState()); diff --git a/WebContent/statictestfiles/jsextension.js b/WebContent/statictestfiles/jsextension.js index be551746ca..d824218560 100644 --- a/WebContent/statictestfiles/jsextension.js +++ b/WebContent/statictestfiles/jsextension.js @@ -1,4 +1,5 @@ window.com_vaadin_tests_extensions_SimpleJavaScriptExtensionTest_SimpleJavascriptExtension = function() { + var self = this; var state = this.getState(); var greetBack = this.getRpcProxyFunction('com.vaadin.tests.extensions.SimpleJavaScriptExtensionTest$SimpleJavaScriptExtensionServerRpc', 'greet'); @@ -10,4 +11,11 @@ window.com_vaadin_tests_extensions_SimpleJavaScriptExtensionTest_SimpleJavascrip } } }); + + this.greetToClient = function(greeting) { + var response = window.prompt(state.prefix + greeting); + if (response !== null) { + self.greetToServer(response); + } + } } \ No newline at end of file -- cgit v1.2.3