This project is not covered by Drupal’s security advisory policy.
The Browser Storage Commands module provides AJAX commands to add and delete data from browser storage (either local or session).
To use it, attach the library to a page or form where you want to use it
$build['#attached']['library'][] = 'browser_storage_commands/ajax';
Then there are two AJAX commands that can be used by adding them to an AjaxResponse:
$response->addCommand(new \Drupal\browser_storage_commands\Ajax\StorageAddCommand('Drupal.my_storage_key', $values, 'local'));
$response->addCommand(new \Drupal\browser_storage_commands\Ajax\StorageDeleteCommand('Drupal.my_storage_key', $values, 'session'));
The commands take three arguments:
1. A string that is the key that you want to store the values in.
2. An array of values. If doing the add command, this will be an associative array with key value pairs. If doing the delete command, it will be an indexed array where the values are the keys that you want to delete. If you pass an empty array, then the whole storage key will be deleted.
3. Which storage you want to use: local or session. It defaults to local.
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.Maintenance fixes only
Considered feature-complete by its maintainers.- Project categories: Developer tools
- Created by bdlangton on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
