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 Translates text to braille, optionally with some parts | 6 * @fileoverview Translates text to braille, optionally with some parts |
7 * uncontracted. | 7 * uncontracted. |
8 */ | 8 */ |
9 | 9 |
10 goog.provide('cvox.ExpandingBrailleTranslator'); | 10 goog.provide('cvox.ExpandingBrailleTranslator'); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 function chunkTranslated(chunk, cells, textToBraille, brailleToText) { | 145 function chunkTranslated(chunk, cells, textToBraille, brailleToText) { |
146 chunk.cells = cells; | 146 chunk.cells = cells; |
147 chunk.textToBraille = textToBraille; | 147 chunk.textToBraille = textToBraille; |
148 chunk.brailleToText = brailleToText; | 148 chunk.brailleToText = brailleToText; |
149 if (--numPendingCallbacks <= 0) | 149 if (--numPendingCallbacks <= 0) |
150 finish(); | 150 finish(); |
151 } | 151 } |
152 | 152 |
153 function finish() { | 153 function finish() { |
154 var totalCells = chunks.reduce( | 154 var totalCells = chunks.reduce( |
155 function(accum, chunk) { return accum + chunk.cells.byteLength}, 0); | 155 function(accum, chunk) { return accum + chunk.cells.byteLength;}, 0); |
dschuyler
2017/05/26 19:00:25
optional:
I think a space should follow the ';'
(t
dpapad
2017/05/26 19:08:39
clang-format will do this (but I am not running it
| |
156 var cells = new Uint8Array(totalCells); | 156 var cells = new Uint8Array(totalCells); |
157 var cellPos = 0; | 157 var cellPos = 0; |
158 var textToBraille = []; | 158 var textToBraille = []; |
159 var brailleToText = []; | 159 var brailleToText = []; |
160 function appendAdjusted(array, toAppend, adjustment) { | 160 function appendAdjusted(array, toAppend, adjustment) { |
161 array.push.apply(array, toAppend.map( | 161 array.push.apply(array, toAppend.map( |
162 function(elem) { return adjustment + elem; } | 162 function(elem) { return adjustment + elem; } |
163 )); | 163 )); |
164 } | 164 } |
165 for (var i = 0, chunk; chunk = chunks[i]; ++i) { | 165 for (var i = 0, chunk; chunk = chunks[i]; ++i) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 }; | 331 }; |
332 }; | 332 }; |
333 | 333 |
334 | 334 |
335 /** | 335 /** |
336 * A character range with inclusive start and exclusive end positions. | 336 * A character range with inclusive start and exclusive end positions. |
337 * @typedef {{start: number, end: number}} | 337 * @typedef {{start: number, end: number}} |
338 * @private | 338 * @private |
339 */ | 339 */ |
340 cvox.ExpandingBrailleTranslator.Range_; | 340 cvox.ExpandingBrailleTranslator.Range_; |
OLD | NEW |