Skip to content

Commit

Permalink
Fix error: "Can't find variable: TextDecoder" (#6011)
Browse files Browse the repository at this point in the history
* Update amp-ad-network-doubleclick-impl.md

* Reverting doc changes

The previous change was made in error (wrong branch).

* Initial changes, need to update tests

* Start fixing tests

* Fix unit test coverage

* revert a4a examples

* Include self (window) when verifying TextDecoder/TextEncoder existence

* fix upstream conflict

* PR feedback

* PR feedback
  • Loading branch information
keithwrightbos authored and jridgewell committed Nov 4, 2016
1 parent 1a1fd8c commit fe4686f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/bytes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {dev} from '../log';
* @return {!Promise<string>}
*/
export function utf8Decode(bytes) {
if (TextDecoder) {
if (typeof TextDecoder !== 'undefined') {
return Promise.resolve(new TextDecoder('utf-8').decode(bytes));
}
return new Promise((resolve, reject) => {
Expand All @@ -44,7 +44,7 @@ export function utf8Decode(bytes) {
* @return {!Promise<!Uint8Array>}
*/
export function utf8Encode(string) {
if (TextEncoder) {
if (typeof TextEncoder !== 'undefined') {
return Promise.resolve(new TextEncoder('utf-8').encode(string));
}
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit fe4686f

Please sign in to comment.