     @level?.get 'slug'
 
   onRunCode: ->
+    @updateKeyValueDb()
     store.commit('game/incrementTimesCodeRun')

      continue unless thangType = _.find thangTypes, (m) -> m.get('name') is spriteName
      continue unless sound = AudioPlayer.soundForDialogue message, thangType.get('soundTriggers')
      AudioPlayer.preloadSoundReference sound
    @session.updateKeyValueDb(e.keyValueDb) if @level.isType('game-dev')

  # Real-time playback
  onRealTimePlaybackStarted: (e) ->

    'ipad:memory-warning': 'onIPadMemoryWarning'
    'store:item-purchased': 'onItemPurchased'
    'tome:manual-cast': 'onRunCode'
    'world:update-key-value-db': 'updateKeyValueDb'

  events:
    'click #level-done-button': 'onDonePressed'
