質問するログイン新規登録

回答編集履歴

2

タイポ

2019/07/24 02:50

投稿

og24715
og24715

スコア832

answer CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  const nextFruits = fruits.concat(newFruit); // -> ['apple', 'banana']
9
9
 
10
- chrome.storage.local.get({ fruits: nextFruits }, function() {
10
+ chrome.storage.local.set({ fruits: nextFruits }, function() {
11
11
  /* noop */
12
12
  });
13
13
  });

1

サンプルコードの修正

2019/07/24 02:50

投稿

og24715
og24715

スコア832

answer CHANGED
@@ -1,10 +1,13 @@
1
1
  `hoge` を配列で持つ。
2
2
 
3
3
  ```
4
- chrome.storage.local.get('hoge', function ({ hoge }) {
4
+ chrome.storage.local.get('fruits', function ({ fruits }) {
5
+ console.log(fruits); // ['apple']
5
- const nextHoge = hoge.concat(newHoge);
6
+ const newFruit = 'banana';
6
7
 
8
+ const nextFruits = fruits.concat(newFruit); // -> ['apple', 'banana']
9
+
7
- chrome.storage.local.get({ hoge }, function() {
10
+ chrome.storage.local.get({ fruits: nextFruits }, function() {
8
11
  /* noop */
9
12
  });
10
13
  });