@@ -3,26 +3,6 @@ import defaultCode from "./app-state/default-code.js"
3
3
import defaultConfig from "./app-state/default-config.js"
4
4
import { linter , ruleCategories } from "./app-state/eslint.js"
5
5
6
- /**
7
- * Convert an Unicode string to base64.
8
- * @param {string } text The string to convert.
9
- * @returns {string } Base64 string.
10
- * @see https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa#Unicode_strings
11
- */
12
- function encodeToBase64 ( text ) {
13
- return window . btoa ( unescape ( encodeURIComponent ( text ) ) )
14
- }
15
-
16
- /**
17
- * Convert a base64 string to Unicode.
18
- * @param {string } base64 The string to convert.
19
- * @returns {string } Unicode string.
20
- * @see https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa#Unicode_strings
21
- */
22
- function decodeFromBase64 ( base64 ) {
23
- return decodeURIComponent ( escape ( window . atob ( base64 ) ) )
24
- }
25
-
26
6
/**
27
7
* The state object for this application.
28
8
*/
@@ -101,7 +81,7 @@ export default class PlaygroundState {
101
81
} )
102
82
const compressedString = pako . deflate ( jsonString , { to : "string" } )
103
83
104
- return encodeToBase64 ( compressedString )
84
+ return btoa ( compressedString )
105
85
}
106
86
107
87
/**
@@ -116,7 +96,7 @@ export default class PlaygroundState {
116
96
try {
117
97
// For backward compatibility, it can address non-compressed data.
118
98
const compressed = ! serializedString . startsWith ( "eyJj" )
119
- const decodedText = decodeFromBase64 ( serializedString )
99
+ const decodedText = atob ( serializedString )
120
100
const jsonText = compressed ? pako . inflate ( decodedText , { to : "string" } ) : decodedText
121
101
const json = JSON . parse ( jsonText )
122
102
let changed = false
0 commit comments