File

modules/session-flow/src/structures/visited-route.ts

Description

User visited route

Constructor

constructor()

Methods

getStartTimeString
getStartTimeString()

Return time start string

Returns: void
getEndTimeString
getEndTimeString()

Return time end string

Returns: void
calcDuration
calcDuration()

Calculate time duration on route

Returns: void
getStringObject
getStringObject()

Return object of visited route

Returns: void

Properties

duration
duration: number

Time duration

route
route: string

Route name

timeEnd
timeEnd: Date

Time when user leaved the route

timeStart
timeStart: Date

Time when user entered to the route

export class VisitedRoute {
  /**
   * Route name
   */
  route: string;

  /**
   * Time when user entered to the route
   */
  timeStart: Date;

  /**
   * Time when user leaved the route
   */
  timeEnd: Date;

  /**
   * Time duration
   */
  duration: number;

  constructor() {
  }

  /**
   * Return time start string
   */
  getStartTimeString(){
    return this.timeStart.toISOString();
  }

  /**
   * Return time end string
   */
  getEndTimeString(){
    return this.timeEnd.toISOString();
  }

  /**
   * Calculate time duration on route
   */
  calcDuration(){
    this.duration = Math.abs(this.timeEnd.getTime() - this.timeStart.getTime());
  }

  /**
   * Return object of visited route 
   */
  getStringObject(){
    let visitedRouteObject = {};
    visitedRouteObject['route'] = this.route;
    visitedRouteObject['timeStart'] = this.timeStart.toISOString();
    visitedRouteObject['timeEnd'] = this.timeEnd.toISOString();
    visitedRouteObject['duration'] = this.duration;
    return visitedRouteObject;
  }

}

results matching ""

    No results matching ""