OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 // Module "ios/mojo/public/js/sync_message_channel" | |
6 // | |
7 // This module provides the synchronous communication channel between | |
8 // JavaScript and native code, which serves as mojo backend. | |
9 | |
10 define("ios/mojo/public/js/sync_message_channel", [], function() { | |
11 var exports = {}; | |
12 | |
13 /** | |
14 * Synchronously sends a message to mojo backend. | |
15 * @param {!Object} message to send. | |
16 * @return {Object} Response from mojo backend. | |
17 */ | |
18 exports.sendMessage = function(message) { | |
19 var response = window.prompt(__gCrWeb.common.JSONStringify(message)); | |
20 return response ? JSON.parse(response) : undefined; | |
21 } | |
22 | |
23 return exports; | |
24 }); | |
OLD | NEW |