             context?.exception = exception
             if let exception = exception?.toString() {
                 print("Client:", "exception", exception)
-                self.delegate.wukongDidThrowException(exception)
+                self.delegate?.wukongDidThrowException(exception)
             }
         }
         context.evaluateScript(script)

            return client.call(withArguments: [platform])
        }(), forProperty: Constant.Script.store)
        print("Client:", "launched")
        delegate.wukongDidLaunch()
    }

    private func jsPromise(_ executor: ((@escaping (JSValue?) -> Void, @escaping (JSValue?) -> Void) -> Void)? = nil) -> JSValue {

    private func setupContext(_ version: String?, _ script: String?) {
        guard let script = script else {
            print("Client:", "failed", version ?? "n/a")
            delegate?.wukongDidFailLoadScript()
            return
        }
        print("Client:", "loaded", version ?? "n/a")
        delegate?.wukongDidLoadScript()
        cleanups.forEach { $0() }
        cleanups.removeAll()
        values.removeAll()
