-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Files app: Using the script to migrate to TS
Bug: b:289003444 Change-Id: I10d80aca795a4c5a7515de5c8c5048139f7bcffd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4979126 Reviewed-by: Wenbo Jie <wenbojie@chromium.org> Commit-Queue: Luciano Pacheco <lucmult@chromium.org> Cr-Commit-Position: refs/heads/main@{#1216734}
- Loading branch information
Luciano Pacheco
authored and
Chromium LUCI CQ
committed
Oct 30, 2023
1 parent
9397594
commit fd89e63
Showing
8 changed files
with
61 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2019 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import {storage} from './storage.js'; | ||
|
||
/** | ||
* Save app launch data to the local storage. | ||
*/ | ||
export function saveAppState() { | ||
if (!window.appState) { | ||
return; | ||
} | ||
|
||
// Maps the appId to JSON serialized AppState. | ||
const items: Record<string, string> = {}; | ||
|
||
items[window.appID] = JSON.stringify(window.appState); | ||
storage.local.setAsync(items); | ||
} | ||
|
||
/** | ||
* Updates the app state. | ||
* | ||
* @param currentDirectoryURL Currently opened directory as an URL.qq | ||
* If null the value is left unchanged. | ||
* @param selectionURL Currently selected entry as an URL. If null the | ||
* value is left unchanged. | ||
*/ | ||
export function updateAppState( | ||
currentDirectoryURL: null|string, selectionURL: null|string) { | ||
window.appState = window.appState || {}; | ||
if (currentDirectoryURL !== null) { | ||
window.appState.currentDirectoryURL = currentDirectoryURL; | ||
} | ||
if (selectionURL !== null) { | ||
window.appState.selectionURL = selectionURL; | ||
} | ||
saveAppState(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters