 import JavaScriptCore
 
 public typealias StateUpdateBlock = (String) -> Void
+public typealias ObserverBlock = (Any?) -> Void
 
 public class Game {
     fileprivate let context = JSContext()
 
     public let inputs:[Input]
     public let outputs:[Output]
+    public let observers:[ObserverBlock]
 
     public var onStateUpdate: StateUpdateBlock?
 
-    public init(story:String, inputs:[String:Input]?, outputs:[String:Output]?, onStateUpdate:StateUpdateBlock?) {
+    public init(story:String, inputs:[String:Input]?, outputs:[String:Output]?, observers:[String:ObserverBlock]?, onStateUpdate:StateUpdateBlock?) {
         if let inputs = inputs {
             self.inputs = Array(inputs.values)
         } else {

            _ = self.context?.evaluateScript("game.receiveInput(sensor, input)")
        }
    }
}

            self.outputs = Array(outputs.values)
        } else {
            self.outputs = []
        }
        
        if let observers = observers {
            self.observers = Array(observers.values)
        } else {
            self.observers = []
        }

        self.onStateUpdate = onStateUpdate
