Options
All
  • Public
  • Public/Protected
  • All
Menu

An event occurred during the game

Hierarchy

  • Event

Index

Constructors

  • new Event(id: string, name: string, game: Game, rule?: Rule): Event
  • Parameters

    • id: string
    • name: string
    • game: Game
    • Optional rule: Rule

    Returns Event

Properties

attributes: Attribute[] = []

Attributes of the event

destX: number = null

Destination X coordinate of the event when the event has a start and end position (ie pass/throw in/goal kick/corner...)

destY: number = null

Destination Y coordinate of the event when the event has a start and end position (ie pass/throw in/goal kick/corner...)

gameTime: number

Game time in seconds from the start of the period.

name: string

Name of the event, something like "Pass", "Shot"....

period: number

Game period, starting from 1.

player: Player

Player that generated the event. May be undefined for some event types.

rule: Rule

The rule that created this event, undefined if it comes from the data source.

state: GameState

Raw tracking data associated with this event.

success: boolean = true

This value describe if the event action has failed or not, the meaning may vary depending on the event type.

team: Team

Team that generated the event. May be undefined for some event types.

worldTime: Date

UTC absolute timestamp of the event.

x: number = null

x position of the event in percent of the field length (0 is the left goal)

y: number = null

y position of the event in percent of the field width (0 is the left sideline)

Accessors

  • if the tracking information is available this object contains the tracking actions relative to the ball

    Returns BallPositionManager

  • get opponent(): Team
  • Get the opponent team (the team that is not the one associated to this event)

    Returns Team

  • if the tracking information is available this object contains the positional information of the players and the ball

    Returns PositionManager

Methods

  • Add an attribute to an event, optionally if you specify a player or a team the attribute will be added to all the events by the given player or team from that point on. If you specify a sequence as target the attribute will be added to all the events in the given sequence.

    Parameters

    • name: string

      name of the attribute

    • Optional value: string

      optional value for the attribute (not available for boolean attrs, like "Cross")

    • Optional target: Team | Player | Sequence

      the target for the attribute, player and team attributes persist from the time you add them to the end of the match

    Returns void

  • canBreakSequences(): boolean
  • Returns true if the event can break a sequence.

    Returns boolean

    if the event can break a sequence

  • canCreateSequence(): boolean
  • Returns true if the event can create a sequence.

    Returns boolean

    if the event can be the first one of a new sequence

  • clone(useCounter?: boolean): Event
  • Clone the event

    Parameters

    • useCounter: boolean = false

    Returns Event

    a new event like the current one, not added to the match, with a different id

  • destinationIn(zone: Zone): boolean
  • Check if the destination coordinates are within the given zone. Destination coordinates may not be available in many events, in that case the API returns false.

    Parameters

    • zone: Zone

      the zone to check against

    Returns boolean

  • distance(other: Event): number
  • Find the distance between two different events as % of the field size.

    Parameters

    • other: Event

      other event

    Returns number

    the distance in %

  • distanceFrom(x: number, y: number): number
  • Find the distance (in % of the field size) of the event from a given point.

    Parameters

    • x: number

      x position on the field (0-100)

    • y: number

      y position on the field (0-100)

    Returns number

    the distance in %

  • doesBreakSequences(): boolean
  • Returns true if this event will break a sequence.

    Returns boolean

    if the event does break the sequences.

  • getAttribute(name: string): string
  • Get the value an attribute with the given name from the event, returns undefined if the attribute does not exist.

    Parameters

    • name: string

      name of the attribute (eg "Cross")

    Returns string

    the attribute value, if it exists, undefined otherwise.

  • Find the depth of a team or a player group.

    DEPTH is the horizontal distance between the front-most and back-most player of the selected player group/team.

    Parameters

    • Optional target: string | Team | PlayerGroup

      the id of the team or the playergroup to apply the depth rule to, if not specified falls back to the team in the current event.

    Returns number

    the number of meters between the front-most and the back-most player, or 0 if tracking data is not available.

  • Find the width of a team or a player group.

    Width is the vertical distance between the left-most and right-most player on a team/player group.

    Parameters

    • Optional target: string | Team | PlayerGroup

      the id of the team or the playergroup to apply the depth rule to, if not specified falls back to the team in the current event.

    Returns number

    the number of meters between the left-most and right-most player, or 0 if tracking data is not available.

  • hasAttribute(name: string): boolean
  • Check if the event has an attribute with the given name.

    Parameters

    • name: string

      name of the attribute (eg "Cross")

    Returns boolean

    a boolean.

  • in(zone: Zone): boolean
  • Check if the event occurred within the given zone.

    Parameters

    • zone: Zone

      the zone to check against

    Returns boolean

  • is(type: string): boolean
  • Check if the event is of the given type (ie event.name === name).

    Parameters

    • type: string

      type of the event (for instance Pass)

    Returns boolean

  • isShot(): boolean
  • Returns true if the event is a shot event

    Returns boolean