<commit_before>import ApiEvents from './events/ApiEvents';
import { firebaseRef } from './appconfig';

var ref = firebaseRef.child('notes');

var API = {
  start() {
    ref.on('child_added', (snapshot) => {
      var noteName = snapshot.key();
      var note = snapshot.val();
      ApiEvents.noteAdded(noteName, note);
    });

    ref.on('child_removed', (snapshot) => {
      var noteName = snapshot.key();
      ApiEvents.noteRemoved(noteName);
    });

    ref.on('child_changed', (snapshot) => {
      var noteName = snapshot.key();
      var note = snapshot.val();
      ApiEvents.noteChanged(noteName, note);
    });
  },

  stop() {
    ref.off('child_added');
    ref.off('child_removed');
    ref.off('child_changed');
  },

  createNote(data) {
    ref.push(data);
  },

  deleteNote(name) {
    ref.child(name).remove();
  },

  updateNote(name, data) {
    ref.child(name).update(data);
  },
};

export default API;
<commit_msg>Rename ref to noteRef in API<commit_after>import ApiEvents from './events/ApiEvents';
import { firebaseRef } from './appconfig';

var noteRef = firebaseRef.child('notes');

var API = {
  start() {
    noteRef.on('child_added', (snapshot) => {
      var noteName = snapshot.key();
      var note = snapshot.val();
      ApiEvents.noteAdded(noteName, note);
    });

    noteRef.on('child_removed', (snapshot) => {
      var noteName = snapshot.key();
      ApiEvents.noteRemoved(noteName);
    });

    noteRef.on('child_changed', (snapshot) => {
      var noteName = snapshot.key();
      var note = snapshot.val();
      ApiEvents.noteChanged(noteName, note);
    });
  },

  stop() {
    noteRef.off('child_added');
    noteRef.off('child_removed');
    noteRef.off('child_changed');
  },

  createNote(data) {
    noteRef.push(data);
  },

  deleteNote(name) {
    noteRef.child(name).remove();
  },

  updateNote(name, data) {
    noteRef.child(name).update(data);
  },
};

export default API;

{'fraction_non_alphanumeric': 0.1731066460587326, 'fraction_numerical': 0.0, 'mean_word_length': 3.0970464135021096, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6365379', 'n_tokens_mistral': 648, 'n_tokens_neox': 647, 'n_words': 113}