Skip to content

Instantly share code, notes, and snippets.

@tomaspietravallo
Created March 6, 2021 15:51
Show Gist options
  • Save tomaspietravallo/64389a94fccc854174623dc4019dba47 to your computer and use it in GitHub Desktop.
Save tomaspietravallo/64389a94fccc854174623dc4019dba47 to your computer and use it in GitHub Desktop.
// Made by Tomás Pietravallo for Diego Aguirre & The Spark AR Community
// Import modules
import Patches from 'Patches';
// Import Typescript types
import { BoolSignal } from 'ReactiveModule';
(async function () {
// await is used to get & resolve the getBoolean() promise
const input1: BoolSignal = await Patches.outputs.getBoolean('InputBool1');
const input2: BoolSignal = await Patches.outputs.getBoolean('InputBool2');
// or() is the Reactive funtion for the boolean operator OR (commonly denoted with || )
// onOn() creates an event every time the OR operation switches from false -> true.
// Patches.inputs.setPulse() returns a pulse to the patch editor
Patches.inputs.setPulse('OutputPulse1', input1.or(input2).onOn());
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment