-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathp5Program.js
More file actions
50 lines (45 loc) · 954 Bytes
/
p5Program.js
File metadata and controls
50 lines (45 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class p5Program
{
constructor(id)
{
this.interval = null;
this.intervalExecute = 1000;
}
addCommand(c)
{
this.commands.push( new p5Command(this,$(c)) );
}
run()
{
let p = new Promise( async (resolve,reject)=>
{
if (this.pc < this.commands.length)
{
await this.commands[this.pc].execute();
}
})
/*
if (this.interval == null)
{
if (this.commands.length > 0)
this.interval = setInterval( this.execute.bind(this),this.intervalExecute );
}
else
{
clearInterval(this.interval);
this.interval = null;
this.pc = 0;
this.run();
}
*/ }
execute()
{
/*
this.commands.forEach( c => c.elmt.removeClass("current") );
let commandCurrent = this.commands[this.pc];
commandCurrent.highlight();
commandCurrent.execute();
this.pc = (this.pc+1)%this.commands.length;
*/
}
}