Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: services/js/test/pingpong.js

Issue 803173009: Mojo JS Bindings: Eliminate foo$ Stub and Proxy class members (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: sync Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/js/test/network_test.js ('k') | sky/framework/shell.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!mojo:js_content_handler 1 #!mojo:js_content_handler
2 2
3 define("main", [ 3 define("main", [
4 "mojo/public/js/bindings",
4 "mojo/services/public/js/application", 5 "mojo/services/public/js/application",
5 "services/js/test/pingpong_service.mojom" 6 "services/js/test/pingpong_service.mojom"
6 ], function(application, pingPongServiceMojom) { 7 ], function(bindings, application, pingPongServiceMojom) {
7 8
9 const ProxyBindings = bindings.ProxyBindings;
10 const StubBindings = bindings.StubBindings;
8 const Application = application.Application; 11 const Application = application.Application;
9 const PingPongService = pingPongServiceMojom.PingPongService; 12 const PingPongService = pingPongServiceMojom.PingPongService;
10 13
11 class PingPongServiceImpl { 14 class PingPongServiceImpl {
12 constructor(app, client) { 15 constructor(app, client) {
13 this.app = app; 16 this.app = app;
14 this.client = client; 17 this.client = client;
15 } 18 }
16 ping(value) { 19 ping(value) {
17 this.client.pong(value + 1); 20 this.client.pong(value + 1);
(...skipping 25 matching lines...) Expand all
43 pingTargetService(pingTargetService, count) { 46 pingTargetService(pingTargetService, count) {
44 return new Promise(function(resolve) { 47 return new Promise(function(resolve) {
45 var pingTargetClient = { 48 var pingTargetClient = {
46 pong: function(value) { 49 pong: function(value) {
47 if (value == count) { 50 if (value == count) {
48 pingTargetService.quit(); 51 pingTargetService.quit();
49 resolve({ok: true}); 52 resolve({ok: true});
50 } 53 }
51 } 54 }
52 }; 55 };
53 pingTargetService.local$ = pingTargetClient; 56 ProxyBindings(pingTargetService).setLocalDelegate(pingTargetClient);
54 for(var i = 0; i <= count; i++) 57 for(var i = 0; i <= count; i++)
55 pingTargetService.ping(i); 58 pingTargetService.ping(i);
56 }); 59 });
57 } 60 }
58 61
59 // This method is only used by the GetTargetService test. 62 // This method is only used by the GetTargetService test.
60 getPingPongService(clientProxy) { 63 getPingPongService(clientProxy) {
61 clientProxy.local$ = new PingPongServiceImpl(this, clientProxy); 64 ProxyBindings(clientProxy).setLocalDelegate(
65 new PingPongServiceImpl(this, clientProxy));
62 } 66 }
63 } 67 }
64 68
65 class PingPong extends Application { 69 class PingPong extends Application {
66 acceptConnection(url, serviceProvider) { 70 acceptConnection(url, serviceProvider) {
67 serviceProvider.provideService( 71 serviceProvider.provideService(
68 PingPongService, PingPongServiceImpl.bind(null, this)); 72 PingPongService, PingPongServiceImpl.bind(null, this));
69 } 73 }
70 } 74 }
71 75
72 return PingPong; 76 return PingPong;
73 }); 77 });
OLDNEW
« no previous file with comments | « services/js/test/network_test.js ('k') | sky/framework/shell.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698