Static p5_sys::global::getItem [−][src]
pub static getItem: GetItemInternalType
Expand description
Returns the value of an item that was stored in local storage using storeItem()
Examples
// Click the mouse to change // the color of the background // Once you have changed the color // it will stay changed even when you // reload the page. let myColor; function setup() { createCanvas(100, 100); myColor = getItem('myColor'); } function draw() { if (myColor !== null) { background(myColor); } } function mousePressed() { myColor = color(random(255), random(255), random(255)); storeItem('myColor', myColor); }
Parameters
key
name that you wish to use to store in local storage