class Resolver < Live::Resolver

Inherits from
Live::Resolver

Extends Live::Resolver to pass shared application state to views on construction.

When the browser reconnects via WebSocket, the resolver creates new view instances with the shared state (e.g. a controller) so all clients stay in sync.

Definitions

def initialize(state = {})

Initialize a new resolver with shared state.

Signature

parameter state Hash

Key-value pairs to pass to view constructors as keyword arguments.

Implementation

def initialize(state = {})
	super()
	@state = state
end

attr :state

Signature

attribute Hash

The shared state passed to view constructors.

def make(view_class, id, data, **options)

Construct a view with shared application state.

Implementation

def make(view_class, id, data, **options)
	super(view_class, id, data, **@state, **options)
end