Storage APIs

removeStorage

Remove cached data by key from local storage.

Overview

my.removeStorage removes cached data from local storage. This is an asynchronous interface. Removing the webview embedded storage data will not remove the storage data of the Mini Program.

Sample Code

my.removeStorage({
  key: 'currentCity',
  success: function(){
    my.alert({content: 'remove success'});
  }
});

Parameters

PropertyTypeRequiredDescription
keyStringYesCache data key.
successFunctionNoCallback function upon call success.
failFunctionNoCallback function upon call failure.
completeFunctionNoCallback function upon call completion (to be executed upon either call success or failure).

Usage Notes

  • This is an asynchronous interface
  • Storage is isolated between embedded webview and Mini Program
  • Removing embedded webview storage does not affect Mini Program storage
  • If the key does not exist, the operation will still succeed