[−][src]Static p5_sys::global::storeItem
pub static storeItem: StoreItemInternalType
Stores a value in local storage under the key name. Local storage is saved in the browser and persists between browsing sessions and page reloads. The key can be the name of the variable but doesn't have to be. To retrieve stored items see getItem. Sensitive data such as passwords or personal information should not be stored in local storage.
Examples
// Type to change the letter in the // center of the canvas. // If you reload the page, it will // still display the last key you entered let myText; function setup() { createCanvas(100, 100); myText = getItem('myText'); if (myText === null) { myText = ''; } } function draw() { textSize(40); background(255); text(myText, width / 2, height / 2); } function keyPressed() { myText = key; storeItem('myText', myText); }
Parameters
key
value