Skip to content

Commit

Permalink
Add comments about rustc cache policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Folyd committed Mar 20, 2021
1 parent eefa192 commit 4f0be20
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extension/script/rustc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
document.addEventListener("DOMContentLoaded", () => {
// rustc search index is a memory cache, therefore we don't use localStorage
// to store the cached-version. Instead, we use `rustc:check` action.
chrome.runtime.sendMessage({action: "rustc:check"},
response => {
let now = new Date();
Expand All @@ -19,6 +21,8 @@ window.addEventListener("message", function (event) {
event.data.direction === "rust-search-extension:rustc") {
let now = new Date();
let version = `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}`;
// rustc search index is a memory cache, therefore we don't use localStorage
// to store the cached-version. Instead, we use `rustc:check` action, see above.
chrome.runtime.sendMessage({action: "rustc:add", version, ...event.data.message},
(response) => {
console.log(response);
Expand Down

0 comments on commit 4f0be20

Please sign in to comment.