localstorage
This commit is contained in:
28
w11_localstorage/files.js
Normal file
28
w11_localstorage/files.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const peopleData = [
|
||||||
|
{ name: 'John', age: 23 },
|
||||||
|
{ name: 'Amy', age: 18 },
|
||||||
|
{ name: 'Hannah', age: 32 },
|
||||||
|
{ name: 'Peter', age: 12 },
|
||||||
|
{ name: 'Mary', age: 27 },
|
||||||
|
];
|
||||||
|
|
||||||
|
function setup() {
|
||||||
|
createCanvas(400, 300);
|
||||||
|
createButton('Save').position(100, 100).size(60).mousePressed(saveData);
|
||||||
|
createButton('Load').position(200, 100).size(60).mousePressed(loadData);
|
||||||
|
|
||||||
|
const input = createFileInput();
|
||||||
|
input.position(100, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
function draw() {
|
||||||
|
background(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveData() {
|
||||||
|
console.log(save);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadData() {
|
||||||
|
console.log(load);
|
||||||
|
}
|
||||||
16
w11_localstorage/index.html
Normal file
16
w11_localstorage/index.html
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<script src='https://cdnjs.cloudflare.com/ajax/libs/p5.js/2.0.5/p5.min.js'
|
||||||
|
integrity='sha512-jOTg6ikYiHx1LvbSOucnvZi4shXbaovZ91+rfViIiUFLgAJK+k1oQtGEaLvDB8rsZwEfUksTgmhrxdvEDykuzQ=='
|
||||||
|
crossorigin='anonymous'></script>
|
||||||
|
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<script defer src="files.js"></script>
|
||||||
|
|
||||||
|
<body></body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user