 
   disconnect: (protocol) ->
     @iframe.removeEventListener 'load', @onLoaded, false
+    if @previewObserver
+      @previewObserver.close()
+      @previewObserver = null
+      @preview = null
 
     # Stop listening to messages
     window.removeEventListener 'message', @onMessage, false

    @address = preview.src

    # Update iframe contents as needed
    if preview.content
      @on 'connected', =>
        body = @iframe.contentDocument.querySelector 'body'
        body.innerHTML = preview.content

    # Start listening for messages from the iframe
    window.addEventListener 'message', @onMessage, false

  normalizePreview: (preview) ->
    unless preview

  constructor: (graph) ->
    # Prepare the iframe and listen to its state
    @origin = window.location.origin
    @preview = null
    @previewObserver = null

    super graph

