I am writing chrome extension and when I write to console "g_ActiveInventory" I get the result:
But when I am trying to get object using this code in my extension:
window.setTimeout(test2, 5000);
function test2()
{
    var size = Object.keys(g_ActiveInventory.rgInventory).size();    
    console.log(size);
}
I am receiving error:
Uncaught ReferenceError: g_ActiveInventory is not defined
How can I fix it?
manifest.json:
{
    "name": "How Many Items",
    "version": "1.0",
    "manifest_version": 2,
    "description": "",
    "icons":    {
        "16": "icons/love.png"
    },
             "background": {
        "scripts": [
            "node_modules/jquery/dist/jquery.min.js"           
        ],
        "persistent": true
    },
    "browser_action": {
        "default_icon": "icons/love.png",
        "default_title": "How Many Items"
    },
    "content_scripts":  [ {
    "js": [ "js/jquery/jquery-1.10.2.min.js", "js/code.js" ],
      "matches": [ "*://steamcommunity.com/tradeoffer/*" ],
      "run_at": "document_end"
      } ]
}
 
     
     
     
    