-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathJavaScriptExecutor.js
More file actions
34 lines (28 loc) · 1.08 KB
/
JavaScriptExecutor.js
File metadata and controls
34 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*******************************************************************************
* Copyright (c) 2012, 2014 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* EclipseSource - initial API and implementation
* Kyle Smith - Add evaluate method
******************************************************************************/
namespace( "rwt.client" );
rwt.client.JavaScriptExecutor = function() {
this.execute = function( code ) {
eval( code );
};
this.evaluate = function( futureId, code ) {
const remote = rwt.remote.Connection.getInstance().getRemoteObject( this );
const retval = eval( code );
remote.call( "complete", {
futureId : futureId,
retval: retval
} );
};
};
rwt.client.JavaScriptExecutor.getInstance = function() {
return rwt.runtime.Singletons.get( rwt.client.JavaScriptExecutor );
};