OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 // Scripts for the message handler for use with WKWebView. |
| 6 |
| 7 /** |
| 8 * Namespace for this module. |
| 9 */ |
| 10 __gCrWeb.message_dynamic = {}; |
| 11 |
| 12 /* Beginning of anonymous object. */ |
| 13 new function() { |
| 14 /** |
| 15 * Sends queued commands to the Objective-C side. |
| 16 * @param {Object} queueObject Queue object containing messages to send. |
| 17 */ |
| 18 __gCrWeb.message_dynamic.sendQueue = function(queueObject) { |
| 19 queueObject.queue.forEach(function(command) { |
| 20 var stringifiedMessage = __gCrWeb.common.JSONStringify({ |
| 21 "crwCommand": command, |
| 22 "crwWindowId": __gCrWeb.windowId |
| 23 }); |
| 24 window.webkit.messageHandlers[queueObject.scheme].postMessage( |
| 25 stringifiedMessage); |
| 26 }); |
| 27 queueObject.reset(); |
| 28 }; |
| 29 } |
OLD | NEW |