Commit e3d4f8b2 authored by Aron Carroll's avatar Aron Carroll

Clarify options and properties on CrossFrameBridge

We nullify the default options to ensure that no objects can be shared
between instances and remove the no-op onConnect callback.
parent e7b4ec08
......@@ -7,19 +7,23 @@ class CrossFrameBridge
# passed:
# - the newly created channel object
# - the window just connected to
onConnect: -> true
onConnect: null
# Any callbacks for messages on the channel. Max one callback per method.
channelListeners: {}
channelListeners: null
# Connected links to other frames
links: null
channelListeners: null
onConnectListeners: null
constructor: (options) ->
@options = $.extend(true, {}, @options, options)
@onConnectListeners = [@options.onConnect]
@channelListeners = @options.channelListeners
@links = []
@channelListeners = @options.channelListeners || {}
@onConnectListeners = []
if typeof @options.onConnect == 'function'
@onConnectListeners.push(@options.onConnect)
createChannel: (source, origin, token) ->
# Set up a channel
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment