 underscore = require('underscore')
 
 class JupyterWrapper extends EventEmitter
-    constructor: (@element, @server_url, @filename, @read_only, @project_id, cb) ->
+    constructor: (@element, @server_url, @filename, @read_only, @project_id, timeout, cb) ->
         @blobs = {}
         @blobs_pending = {}
         @state = 'loading'

        if @state != 'loading'
            cb("init_dom BUG: @state must be loading")
            return
        @notebook.css('opacity',0)  # invisible, so you don't see a funny half-loaded notebook (from the file rather than the syncstring), before monkey patching.
        done = (err) =>
            @notebook.css('opacity',1)

        # wait until connected -- iT is ***critical*** to wait until
        # the kernel is connected before doing anything else!
        start = new Date()
        max_time_ms = timeout*1000 # try for up to this long
        f = () =>
            @frame ?= window.frames[@iframe_uuid]
            if not @frame
