Skip to content

Trace Structure Template

amesbah edited this page Feb 2, 2013 · 4 revisions

The following structures will be used to save information about "stories" before being translated into the data-structure:

1 DOM Events

DOMEvent {
  messageType: "DOM_EVENT",
  timeStamp: TimeStamp,
  eventType: "click", "load", ..., 
  targetElement: DOMElement, 
  eventHandler: Function,
}

2 Timing Events

TimeoutSet {
  messageType: "TIMEOUT_SET", 
  timeStamp: TimeStamp,
  ID: int,
  callbackFunction: Function
  delay: int,
  arguments: Variable[ ]
}

TimeoutCallback {
  messageType: "TIMEOUT_CALLBACK", 
  timeStamp: TimeStamp,
  ID: int,
  callbackFunction: Function
}

3 XHR Events

XHROpen {
  messageType: "XHR_OPEN", 
  timeStamp: TimeStamp,
  ID: int,
  method: "GET" or "POST"
  serverURL: String
  async: boolean,
}

XHRSend {
  messageType: "XHR_SEND",
  timeStamp: TimeStamp, 
  ID: int,
  message: String
}

XHRResponse {
  messageType: "XHR_SEND",
  timeStamp: TimeStamp,
  ID: int,
  callbackFunction: Function, 
  response: String
}

4 Function Tracing

FunctionCall {
  messageType: "FUNCTION_CALL", 
  timeStamp: TimeStamp, 
  targetFunction: Function,
  lineNo: int
}

FunctionEnter {
  messageType: "FUNCTION_ENTER",
  timeStamp: TimeStamp,
  targetFunction: Function,
  lineNo: int
}

FunctionExit {
  messageType: "FUNCTION_EXIT",
  timeStamp: TimeStamp,
  targetFunction: Function,
  lineNo: int
}

ReturnStatement {
  messageType: "RETURN_STATEMENT",
  timeStamp: TimeStamp,
  returnValue: Variable,
  lineNo: int
}

5 Primitive Types

TimeStamp: { 
  year: int
  month: int
  day: int
  hour: int
  minute: int
  second: int
  millisecond: int 
}

DOMElement: {
  attrList: Attribute[]
}

Function: { 
  name: String
  arguments: TBD
}

Variable: { 
  value: ?
  label: String
}

That is, information will be pulled from the above JSONObjects to create data classes for our API in the future.