 
   runtimeHandlers: ->
     "loadInteractiveGlobal": (data) =>
-      key = @globalStateKey
-      data = JSON.parse(data) if typeof data is 'string'
-      myData = data[key]
+      @globalState = JSON.parse(data) if typeof data is 'string'
+      myData = @globalState[@globalStateKey]
       if myData
         @interactivePhone.post 'sendDatasetEvent',
           "eventName": 'dataReset'

    "getDataset": () =>
      l.info("getDataSet sent by interactive (what to do?)")
    "dataset": (data)=>
      @runtimePhone.post('interactiveStateGlobal', {"#{@globalStateKey}": data})

  interactivePhoneAnswered: ()->
    if @alreadySetupInteractive


module.exports = class Wrapper
  constructor: (id) ->
    @globalState = {}
    @updateRuntimeDataSchedule = false
    @updateInterval = 500 # 0.5s
    @loadConfiguration()
