mercredi 25 juillet 2018

Chrome dev tools become slow or unresponsive if I use local storage in the script

I am trying to make a simple to do app using chrome local storage. The app and dev tools works just fine without using local storage. But when I include local storage in the code, the dev tools gets drastically slow.

Here is my code snippet-

$('input').keypress(function(e) {
  if (e.which == 13 && $('input').val().length > 0) {
    //localStorage.setItem("task-"+i, $('input').val())   ==>This line causes                                                                  the issue
    $('ul').append(addItem(i));
    $('input').val('');
    i++;
  }
});


$('ul.list-group').on("click", "button.btn", function() {
  //localStorage.removeItem($(this).parent().attr('id'));    ==>This line                                                                           causes                                                                         the issue
  $(this).parent().remove()
});



Aucun commentaire:

Enregistrer un commentaire