Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 goog.require('chromium.DevTools.Connection'); | |
| 6 goog.require('chromium.DevTools.DOM'); | |
| 7 goog.require('chromium.DevTools.Runtime'); | |
| 8 goog.provide('chromium.BindingsTest'); | |
| 9 | |
| 10 /** | |
| 11 * Evaluates 1+1 and returns the result over the chromium.DevTools.Connection. | |
| 12 */ | |
| 13 chromium.BindingsTest.evalOneAddOne = function() { | |
| 14 let connection = new chromium.DevTools.Connection(window.TabSocket); | |
| 15 let Runtime = new chromium.DevTools.Runtime(connection); | |
| 16 Runtime.Evaluate({'expression': '1+1'}).then(function(message) { | |
| 17 connection.sendDevToolsMessage( | |
| 18 '__Result', | |
| 19 {'result': JSON.stringify(message.result.value)}); | |
| 20 }); | |
| 21 }; | |
| 22 | |
| 23 chromium.BindingsTest.listenForChildNodeCountUpdated = function() { | |
| 24 let connection = new chromium.DevTools.Connection(window.TabSocket); | |
| 25 let DOM = new chromium.DevTools.DOM(connection); | |
| 26 DOM.OnChildNodeCountUpdated(function(params) { | |
| 27 connection.sendDevToolsMessage('__Result', | |
| 28 {'result': JSON.stringify(params)}); | |
| 29 }); | |
| 30 DOM.Enable().then(function() { | |
|
dpapad
2017/06/07 17:49:23
Prefer Promise chaining over nesting where possibl
alex clarke (OOO till 29th)
2017/06/08 10:33:16
Done.
| |
| 31 DOM.GetDocument({}).then(function(result) { | |
|
dpapad
2017/06/07 17:49:23
|result| is not being used anywhere. Can you omit
alex clarke (OOO till 29th)
2017/06/08 10:33:16
Done.
| |
| 32 // Create a new div which should trigger the event. | |
| 33 let div = document.createElement('div'); | |
| 34 document.body.appendChild(div); | |
| 35 }); | |
| 36 }); | |
| 37 }; | |
| OLD | NEW |