OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Bridge to MathJax functions from the ChromeVox content script. | 6 * @fileoverview Bridge to MathJax functions from the ChromeVox content script. |
7 * | 7 * |
8 */ | 8 */ |
9 | 9 |
10 if (typeof(goog) != 'undefined' && goog.provide) { | 10 if (typeof(goog) != 'undefined' && goog.provide) { |
(...skipping 20 matching lines...) Expand all Loading... |
31 }; | 31 }; |
32 | 32 |
33 | 33 |
34 /** | 34 /** |
35 * Initializes message channel in Chromevox. | 35 * Initializes message channel in Chromevox. |
36 */ | 36 */ |
37 cvox.MathJax.initMessage = function() { | 37 cvox.MathJax.initMessage = function() { |
38 channel_.port1.onmessage = function(evt) { | 38 channel_.port1.onmessage = function(evt) { |
39 cvox.MathJax.execMessage(evt.data); | 39 cvox.MathJax.execMessage(evt.data); |
40 }; | 40 }; |
41 window.postMessage('cvox.MathJaxPortSetup', [channel_.port2], '*'); | 41 window.postMessage('cvox.MathJaxPortSetup', '*', [channel_.port2]); |
42 }; | 42 }; |
43 | 43 |
44 | 44 |
45 /** | 45 /** |
46 * Post a message to Chromevox. | 46 * Post a message to Chromevox. |
47 * @param {string} cmd The command to be executed in Chromevox. | 47 * @param {string} cmd The command to be executed in Chromevox. |
48 * @param {string} callbackId A string representing the callback id. | 48 * @param {string} callbackId A string representing the callback id. |
49 * @param {Object<string, *>} args Dictionary of arguments. | 49 * @param {Object<string, *>} args Dictionary of arguments. |
50 */ | 50 */ |
51 cvox.MathJax.postMessage = function(cmd, callbackId, args) { | 51 cvox.MathJax.postMessage = function(cmd, callbackId, args) { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 cvox.MathJax.postMessage( | 179 cvox.MathJax.postMessage( |
180 'Active', callbackId, | 180 'Active', callbackId, |
181 {'status': cvox.MathJaxExternalUtil.isActive()}); | 181 {'status': cvox.MathJaxExternalUtil.isActive()}); |
182 }; | 182 }; |
183 | 183 |
184 | 184 |
185 // Initializing the bridge. | 185 // Initializing the bridge. |
186 cvox.MathJax.initMessage(); | 186 cvox.MathJax.initMessage(); |
187 | 187 |
188 })(); | 188 })(); |
OLD | NEW |