How to use the st/globals.gaEvent function in st

To help you get started, we’ve selected a few st examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leafo / sightreading.training / static / js / components / pages / sight_reading_page.es6 View on Github external
this.setState({
          noteShaking: true,
          heldNotes: {},
          touchedNotes: {},
        });

        setTimeout(() => this.setState({noteShaking: false}), 500);
        break
      }

      case "chords": {
        let touched = Object.keys(this.state.touchedNotes);

        if (this.state.notes.matchesHead(touched) && touched.length > 2) {
          gaEvent("sight_reading", "chord", "hit");
          this.state.notes.shift()
          this.state.notes.pushRandom()

          this.state.stats.hitNotes([])

          this.setState({
            notes: this.state.notes,
            noteShaking: false,
            heldNotes: {},
            touchedNotes: {},
          })

          this.state.slider.add(1)
        } else {
          gaEvent("sight_reading", "chord", "miss");
github leafo / sightreading.training / static / js / components / pages / sight_reading_page.es6 View on Github external
checkPress() {
    switch (this.state.currentGenerator.mode) {
      case "notes": {
        let touched = Object.keys(this.state.touchedNotes);
        if (this.state.notes.matchesHead(touched, this.state.anyOctave)) {
          gaEvent("sight_reading", "note", "hit");

          this.state.notes.shift();
          this.state.notes.pushRandom();
          this.state.stats.hitNotes(touched);

          this.setState({
            notes: this.state.notes,
            noteShaking: false,
            heldNotes: {},
            touchedNotes: {},
          });

          this.state.slider.add(1)

          return true
        } else {
github leafo / sightreading.training / static / js / components / pages / sight_reading_page.es6 View on Github external
gaEvent("sight_reading", "chord", "hit");
          this.state.notes.shift()
          this.state.notes.pushRandom()

          this.state.stats.hitNotes([])

          this.setState({
            notes: this.state.notes,
            noteShaking: false,
            heldNotes: {},
            touchedNotes: {},
          })

          this.state.slider.add(1)
        } else {
          gaEvent("sight_reading", "chord", "miss");

          this.state.stats.missNotes([])

          this.setState({
            noteShaking: true,
            heldNotes: {},
            touchedNotes: {},
          })

          setTimeout(() => this.setState({noteShaking: false}), 500);
        }
        break
      }
    }
  }
github leafo / sightreading.training / static / js / components / pages / sight_reading_page.es6 View on Github external
checkRelease() {
    switch (this.state.currentGenerator.mode) {
      case "notes": {
        let missed = this.state.notes.currentColumn()
          .filter((n) => !this.state.heldNotes[n]);

        gaEvent("sight_reading", "note", "miss");
        this.state.stats.missNotes(missed);

        this.setState({
          noteShaking: true,
          heldNotes: {},
          touchedNotes: {},
        });

        setTimeout(() => this.setState({noteShaking: false}), 500);
        break
      }

      case "chords": {
        let touched = Object.keys(this.state.touchedNotes);

        if (this.state.notes.matchesHead(touched) && touched.length > 2) {