Added once() method
This commit is contained in:
14
src/API.ts
14
src/API.ts
@ -128,6 +128,8 @@ export class UserAPI {
|
||||
public MidiConnection: MidiConnection;
|
||||
public scale_aid: string | number | undefined = undefined;
|
||||
public hydra: any;
|
||||
public onceEvaluator: boolean = true;
|
||||
|
||||
load: samples;
|
||||
|
||||
constructor(public app: Editor) {
|
||||
@ -912,6 +914,18 @@ export class UserAPI {
|
||||
// Counter and iteration
|
||||
// =============================================================
|
||||
|
||||
public once = (): boolean => {
|
||||
/**
|
||||
* Returns true if the code is being evaluated for the first time.
|
||||
*
|
||||
* @returns True if the code is being evaluated for the first time
|
||||
*/
|
||||
const firstTime = this.app.api.onceEvaluator;
|
||||
this.app.api.onceEvaluator = false;
|
||||
|
||||
return firstTime;
|
||||
}
|
||||
|
||||
public counter = (
|
||||
name: string | number,
|
||||
limit?: number,
|
||||
|
||||
Reference in New Issue
Block a user