Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7538115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:02:10+00:00 2026-05-30T07:02:10+00:00

In my code this.options returns object with .all object nested. Yet when I try

  • 0

In my code this.options returns object with .all object nested. Yet when I try to access it with this.options['all'] or this.options.all I get undefined.

console.log(this.options):

Object
    all: Object
        cfg_autoresize: "true"
        cfg_autosave: "false"
        cfg_monthly_target: "monthly_target"
        cfg_statistics: "statistics"
        cfg_ticker: "ticker"
        cfg_yearly_target: "yearly_target"
    __proto__: Object

Could someone help me figure this out, never had this issue before. Thanks

Edit:

content_script, simplified version

var Dashboard = Backbone.View.extend({
    el: $('body'),
    options: {},

    get_localStorage: function() {
        var _this = this;
        function handle_response(response) {_this.options.all = response.data;}
        chrome.extension.sendRequest({method: "allLocalStorage"}, handle_response);
    },

    initialize: function() {
        this.get_localStorage();
        console.log(this.options); // above object
        console.log(this.options.all); //undefined
    }
});

background.html, taken from Google-chrome-extension docs and modified

chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
    if(request.method == "allLocalStorage") {

        var options = {};

        for (var i=0, l=localStorage.length; i<l; i++){
            var key = localStorage.key(i);
            var value = localStorage[key];
            options[key] = value;
        }

        sendResponse({data: options}); 

    } else {
        sendResponse({}); 
    }
});

Ideally I would like to have this.options have all options inside of it without .all but it would not work for me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:02:12+00:00Added an answer on May 30, 2026 at 7:02 am

    Can you show us part of the js code (declaration and object access) that seems incorrect?

    EDIT:

    Ah i see… at the time you call get_localStorage(); the object might not being initialized due to the fact that the handle_response function will yet not get triggered before the sendRequest finishes.

    you probably want to try something like the following:

    get_localStorage: function(callback) {
        var _this = this;
        function handle_response(response) {
            _this.options.all = response.data;     
            callback(_this.options);
        }
        chrome.extension.sendRequest({method: "allLocalStorage"}, handle_response);
    }
    
    initialize: function() {
        this.get_localStorage(function(op) {
                console.log(op);
                console.log(op.all);
            }
        );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in my .htaccess: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule
This is my TinyMCE code: tinyMCE.init({ // General options mode : textareas, theme :
I need your advice on this piece of code: the table fields options[0], options[1]
I have the following jquery code: jQuery(function(){ jQuery(select#rooms).change(function(){ var options = ''; jQuery.getJSON(/admin/selection.php,{id: jQuery(this).val(),
I'm trying to get all options values of a multiple select with the following
I have a code like this: var a = selectBox.options[selectBox.selectedIndex]; If I execute: alert(a);
I'm new to PHP and I want this code <option value= disabled=disabled>-------------</option> to be
This very simple code: #include <iostream> using namespace std; void exec(char* option) { cout
I have this code here: var infiltrationResult; while(thisOption) { var trNode = document.createElement('tr'); var
Is it possible to code this sequence of events once an iPhone app has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.