public void AddAttribute(IJavascriptObject father, string attibutename, IJavascriptObject value) { _WebView.Run(() => { var mobx = _WebView.GetGlobal().GetValue("mobx"); var helper = _WebView.Factory.CreateObject(ObjectObservability.ReadOnly); helper.SetValue(attibutename, value); mobx.InvokeNoResult("extendObservable", _WebView, father, helper); }); }
private IJavascriptObject UnSafeGetRootViewModel() { var window = _WebView.GetGlobal(); var ko = window.GetValue("ko"); var document = window.GetValue("document"); var body = document.GetValue("body"); return(ko.Invoke("dataFor", _WebView, body)); }
private IJavascriptObject GetVueHelper() { var vueHelper = _WebView.GetGlobal().GetValue("glueHelper"); if ((vueHelper == null) || (vueHelper.IsUndefined)) { throw ExceptionHelper.Get("glueHelper not found!"); } return(vueHelper); }
private IJavascriptObject GetMoxHelper() { var mobxHelper = _WebView.GetGlobal().GetValue("mobxManager"); if ((mobxHelper == null) || (mobxHelper.IsUndefined)) { throw ExceptionHelper.Get("mobxManager not found!"); } return(mobxHelper); }
public WebViewListener(IWebView webView) { _WebView = webView; _Listener = _WebView.Factory.CreateObject(false); _Listener.Bind("postMessage", _WebView, (e) => PostMessage(e[0].GetStringValue(), e[1].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); }
private IJavascriptObject GetKo() { if (_Ko == null) { _Ko = _IWebView.GetGlobal().GetValue("ko"); if ((_Ko == null) || (!_Ko.IsObject)) { throw ExceptionHelper.NoKo(); } } return(_Ko); }
private IJavascriptObject GetKo() { if (_Ko != null) { return(_Ko); } _Ko = _WebView.GetGlobal().GetValue("ko"); if ((_Ko == null) || (!_Ko.IsObject)) { throw ExceptionHelper.Get("ko object not found! You should add a link to knockout.js script to the HML document!"); } _Ko.Bind("log", _WebView, (e) => _logger.Info(() => string.Join(" - ", e.Select(s => (s.GetStringValue().Replace("\n", " ")))))); return(_Ko); }
private IJavascriptObject UnSafeGetRootViewModel() { var window = _WebView.GetGlobal(); return(window.GetValue("vm")); }
public void AddAttribute(IJavascriptObject father, string attributeName, IJavascriptObject value) { var vue = _WebView.GetGlobal().GetValue("Vue"); vue.InvokeNoResult("set", _WebView, father, _WebView.Factory.CreateString(attributeName), value); }