jpm giving Error on adding the required Sdk library

320 Views Asked by At

As per MDN we can use the browser's local storage using the simple-storage module. But when I am trying to include any package in the .js file i get the error saying

JPM undefined   Message: ReferenceError: require is not defined

The sample code for one of my js files is as follows

// Creating the Object for Accessing the local browser storage
var ss = require("sdk/simple-storage");
//Fetching the values in the various fields
var id = document.getElementById("usermail");
var pass = document.getElementById("password");
var login = document.getElementById("login");

//Saving the values for the id and password fields

login.addEventListener("click", function() {
    storage_object.storage.Email = id.value ;
    storage_object.storage.Password = pass.value;
    login_Email = storage_object.storage.Email; 
    login_pass = storage_object.storage.Password;
    alert(login_pass);
});

how to use the browser local storage in the add-on?

0

There are 0 best solutions below