   @param {Number} [config.timeout=3000] - request timeout (ms)
   @param {Function<Boolean>} config.isParentValidFn - restrict parent origin
   ###
-  constructor: ({timeout, @handshakeTimeout, @isParentValidFn} = {}) ->
+  constructor: ({timeout, @handshakeTimeout, @isParentValidFn, useSw} = {}) ->
     @isParentValidFn ?= -> true
     timeout ?= null
     @handshakeTimeout ?= DEFAULT_HANDSHAKE_TIMEOUT_MS


    @clientValidation = @client.call 'ping', null, {timeout: @handshakeTimeout}
    .then (registeredMethods) =>
      if registeredMethods is 'pong'
        @isLegacy = true
      else if @hasParent

        @parent?.postMessage msg, origin
    })

    useSw ?= navigator.serviceWorker and window.location.protocol isnt 'http:'

    if useSw
      # only use service workers if current page has one
      @ready = navigator.serviceWorker.ready
      .catch -> null
