summaryrefslogtreecommitdiffstats
path: root/WebContent/statictestfiles/jsextension.js
blob: 1a46300e457843f951d656c271d18313f94c1967 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
window.com_vaadin_tests_extensions_SimpleJavaScriptExtensionTest_SimpleJavascriptExtension = function() {
	var self = this;
	var state = this.getState();
	
	//var rpc = this.getRpcProxy("com.vaadin.tests.extensions.SimpleJavaScriptExtensionTest.SimpleJavaScriptExtensionServerRpc");
	var rpc = this.getRpcProxy();

//	this.registerRpc("com.vaadin.tests.extensions.SimpleJavaScriptExtensionTest.SimpleJavaScriptExtensionClientRpc", {
	this.registerRpc({
		'greet': function(greeting) {
			var response = window.prompt(state.prefix + greeting);
			if (response !== null) {
				rpc.greet(response);
			}
		}
	});
	
	this.greetToClient = function(greeting) {
		var response = window.prompt(state.prefix + greeting);
		if (response !== null) {
			self.greetToServer(response);
		}
	} 
}