Check if Item is already in the Context Menu
<p>A while ago I could save ID of the created item for the context menu in Google Chrome Extensions:</p>

<p><em>background.js:</em></p>

<pre><code>var myItem;

if (myItem !== "MyItem") {
    myItem = chrome.contextMenus.create({
        title: "My item",
        id: 'MyItem',
        contexts: ["page"]
    });
}
</code></pre>

<p>But now when I open Chrome first it says:</p>

<blockquote>
  <p>Unchecked runtime.lastError while running contextMenus.create: Cannot
  create item with duplicate id MyItem</p>
</blockquote>

<p>(from debug console)</p>

<p>So it doesn't remember my variable "myItem" (its data) anymore when I close Chrome. It only remembers while Chrome is opened.</p>

<p>So now should I use <code>chrome.storage.local.get</code> or <code>set</code> to save ID of my Context Menu Items?</p>

<p><strong>Update:</strong> </p>

<p>The problem was a <code>"persistent": false</code> in manifest for background:</p>

<pre><code>   "background": {
      "scripts": [ "background.js" ]
   },
</code></pre>

<p>Removed it &amp; now it works normally <strong>[Solved]</strong></p>