@@ -3,26 +3,6 @@ import defaultCode from "./app-state/default-code.js"
33import defaultConfig from "./app-state/default-config.js"
44import { linter , ruleCategories } from "./app-state/eslint.js"
55
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-
266/**
277 * The state object for this application.
288 */
@@ -101,7 +81,7 @@ export default class PlaygroundState {
10181 } )
10282 const compressedString = pako . deflate ( jsonString , { to : "string" } )
10383
104- return encodeToBase64 ( compressedString )
84+ return btoa ( compressedString )
10585 }
10686
10787 /**
@@ -116,7 +96,7 @@ export default class PlaygroundState {
11696 try {
11797 // For backward compatibility, it can address non-compressed data.
11898 const compressed = ! serializedString . startsWith ( "eyJj" )
119- const decodedText = decodeFromBase64 ( serializedString )
99+ const decodedText = atob ( serializedString )
120100 const jsonText = compressed ? pako . inflate ( decodedText , { to : "string" } ) : decodedText
121101 const json = JSON . parse ( jsonText )
122102 let changed = false
0 commit comments