예제 #1
0
        public WebViewListener(IWebView webView)
        {
            _WebView = webView;

            _Listener = _WebView.Factory.CreateObject();
            _Listener.BindArguments("postMessage", _WebView, (chanel, message) => PostMessage(chanel.GetStringValue(), message.GetStringValue()));
            _WebView.GetGlobal().SetValue("__neutronium_listener__", _Listener, CreationOption.DontDelete | CreationOption.ReadOnly | CreationOption.DontEnum);

            var loader = new ResourceReader("Communication.script.dist", this);
            var data   = loader.Load("communication.js");

            _WebView.ExecuteJavaScript(data);
        }