<commit_before>/* See license.txt for terms of usage */

"use strict";

module.metadata = {
  "stability": "experimental"
};

const { Trace, TraceError } = require("../core/trace.js");
const { Domplate } = require("../core/domplate.js");
const { Rep } = require("./rep.js");
const { Reps } = require("./reps.js");

// Domplate
const { domplate } = Domplate;
const { OBJECTLINK } = Rep.tags;

/**
 * @rep
 */
var Event = domplate(Rep,
/** @lends Event */
{
  className: "event",

  tag:
    OBJECTLINK("$object|summarizeEvent"),

  summarizeEvent: function(grip) {
    var info = [grip.preview.type, " "];

    let eventFamily = grip.class;
    let props = grip.preview.properties;

    if (eventFamily == "MouseEvent")
      info.push("clientX=", props.clientX, ", clientY=", props.clientY);
    else if (eventFamily == "key")
      info.push("charCode=", props.charCode, ", keyCode=", props.keyCode);
    else if (event.type == "message")
      info.push("origin=", props.origin, ", data=", props.data);

    return info.join("");
  },

  supportsObject: function(grip, type) {
    return (grip.preview && grip.preview.kind == "DOMEvent");
  },

  getTitle: function(grip, context) {
    return "Event " + grip.type;
  }
});

// Registration
Reps.registerRep(Event);
<commit_msg>Fix event class name<commit_after>/* See license.txt for terms of usage */

"use strict";

module.metadata = {
  "stability": "experimental"
};

const { Trace, TraceError } = require("../core/trace.js");
const { Domplate } = require("../core/domplate.js");
const { Rep } = require("./rep.js");
const { Reps } = require("./reps.js");

// Domplate
const { domplate } = Domplate;
const { OBJECTLINK } = Rep.tags;

/**
 * @rep
 */
var Event = domplate(Rep,
/** @lends Event */
{
  className: "event",

  tag:
    OBJECTLINK("$object|summarizeEvent"),

  summarizeEvent: function(grip) {
    var info = [grip.preview.type, " "];

    let eventFamily = grip.class;
    let props = grip.preview.properties;

    if (eventFamily == "MouseEvent")
      info.push("clientX=", props.clientX, ", clientY=", props.clientY);
    else if (eventFamily == "KeyboardEvent")
      info.push("charCode=", props.charCode, ", keyCode=", props.keyCode);
    else if (eventFamily == "MessageEvent")
      info.push("origin=", props.origin, ", data=", props.data);

    return info.join("");
  },

  supportsObject: function(grip, type) {
    return (grip.preview && grip.preview.kind == "DOMEvent");
  },

  getTitle: function(grip, context) {
    return "Event " + grip.type;
  }
});

// Registration
Reps.registerRep(Event);

{'fraction_non_alphanumeric': 0.18854045683313975, 'fraction_numerical': 0.0, 'mean_word_length': 3.4783362218370883, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '6465153', 'n_tokens_mistral': 891, 'n_tokens_neox': 863, 'n_words': 189}