/// <summary> /// Return a reference to the JS instance located on the given property /// </summary> /// <param name="jsRuntime">Current JS rntime</param> /// <param name="jsObjectRef">Refernece to the parent instance</param> /// <param name="propertyPath">property path</param> /// <returns></returns> public static async Task <JsRuntimeObjectRef> GetInstancePropertyRefAsync(this IJSRuntime jsRuntime, JsRuntimeObjectRef jsObjectRef, string propertyPath) { JsRuntimeObjectRef jsRuntimeObjectRef = await jsRuntime.InvokeAsync <JsRuntimeObjectRef>("browserInterop.getInstancePropertyRef", jsObjectRef, propertyPath); jsRuntimeObjectRef.JSRuntime = jsRuntime; return(jsRuntimeObjectRef); }
internal override void SetJsRuntime(IJSRuntime jsRuntime, JsRuntimeObjectRef navigatorRef) { base.SetJsRuntime(jsRuntime, navigatorRef); Geolocation = new WindowNavigatorGeolocation(jsRuntime); Storage = new WindowStorageManager(jsRuntime); Connection?.SetJsRuntime(jsRuntime, navigatorRef); }
internal void SetJSRuntime(IJSRuntime jsRuntime, JsRuntimeObjectRef jsRuntimeObjectRef) { this.jsRuntime = jsRuntime; this.jsRuntimeObjectRef = jsRuntimeObjectRef; Geolocation = new GeolocationInterop(jsRuntime); Storage = new StorageManagerInterop(jsRuntime); this.Connection?.SetJsRuntime(jsRuntime, jsRuntimeObjectRef); }
public override void SetJsRuntime(IJSRuntime jsRuntime, JsRuntimeObjectRef jsRuntimeObjectRef) { localStorageLazy = new Lazy <StorageInterop>(() => new StorageInterop(jsRuntime, jsRuntimeObjectRef, "localStorage")); sessionStorageLazy = new Lazy <StorageInterop>(() => new StorageInterop(jsRuntime, jsRuntimeObjectRef, "sessionStorage")); consoleInteropLazy = new Lazy <ConsoleInterop>(() => new ConsoleInterop(jsRuntime, jsRuntimeObjectRef)); historyInteropLazy = new Lazy <HistoryInterop>(() => new HistoryInterop(jsRuntime, jsRuntimeObjectRef)); performanceInteropLazy = new Lazy <PerformanceInterop>(() => new PerformanceInterop(jsRuntime, jsRuntimeObjectRef)); framesArrayInteropLazy = new Lazy <FramesArrayInterop>(() => new FramesArrayInterop(jsRuntimeObjectRef, jsRuntime)); personalBarLazy = new Lazy <BarPropInterop>(() => new BarPropInterop(jsRuntimeObjectRef, "personalbar", jsRuntime)); locationBarLazy = new Lazy <BarPropInterop>(() => new BarPropInterop(jsRuntimeObjectRef, "locationbar", jsRuntime)); menuBarLazy = new Lazy <BarPropInterop>(() => new BarPropInterop(jsRuntimeObjectRef, "menubar", jsRuntime)); scrollBarsLazy = new Lazy <BarPropInterop>(() => new BarPropInterop(jsRuntimeObjectRef, "scrollbars", jsRuntime)); statusBarLazy = new Lazy <BarPropInterop>(() => new BarPropInterop(jsRuntimeObjectRef, "statusbar", jsRuntime)); toolBarLazy = new Lazy <BarPropInterop>(() => new BarPropInterop(jsRuntimeObjectRef, "toolbar", jsRuntime)); base.SetJsRuntime(jsRuntime, jsRuntimeObjectRef); }
/// <summary> /// Set the js object property value /// </summary> /// <param name="jsRuntime"></param> /// <param name="propertyPath"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static async Task SetInstancePropertyAsync(this IJSRuntime jsRuntime, JsRuntimeObjectRef jsObjectRef, string propertyPath, object value) { await jsRuntime.InvokeVoidAsync("browserInterop.setInstanceProperty", jsObjectRef, propertyPath, value); }
/// <summary> /// Get the js object property value /// </summary> /// <param name="jsRuntime">current js runtime</param> /// <param name="propertyPath">path of the property</param> /// <param name="jsObjectRef">Ref to the js object from which we'll get the property</param> /// <param name="deep">If true,(default) then the full object is received.await If false, only the object root</param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static async Task <T> GetInstancePropertyAsync <T>(this IJSRuntime jsRuntime, JsRuntimeObjectRef jsObjectRef, string propertyPath, bool deep = true) { return(await jsRuntime.InvokeAsync <T>("browserInterop.getInstancePropertySerializable", jsObjectRef, propertyPath, deep)); }
internal void SetJsRuntime(IJSRuntime jSRuntime, JsRuntimeObjectRef windowObject) { this.jSRuntime = jSRuntime; this.windowObject = windowObject; }
internal void SetJsRuntime(IJSRuntime jSRuntime, JsRuntimeObjectRef jsRuntimeObject) { this.jsRuntime = jSRuntime; this.jsRuntimeObject = jsRuntimeObject; }
internal WindowFramesArray(JsRuntimeObjectRef jsRuntimeObjectRef, IJSRuntime jsRuntime) { this.jsRuntimeObjectRef = jsRuntimeObjectRef; this.jsRuntime = jsRuntime; }
internal WindowConsole(IJSRuntime jsRuntime, JsRuntimeObjectRef windowObject) { this.jsRuntime = jsRuntime; this.windowObject = windowObject; }
internal BarProp(JsRuntimeObjectRef windowRef, string propertyName, IJSRuntime jsRuntime) { this.windowRef = windowRef; this.propertyName = propertyName; this.jsRuntime = jsRuntime; }
internal void SetJsRuntime(IJSRuntime jsRuntime, JsRuntimeObjectRef propertyRef) { this.jsRuntime = jsRuntime; this.windowRef = propertyRef; }
internal HistoryInterop(IJSRuntime jsRuntime, JsRuntimeObjectRef jsRuntimeObjectRef) { this.jsRuntime = jsRuntime; this.jsRuntimeObjectRef = jsRuntimeObjectRef; }
internal StorageInterop(IJSRuntime jsRuntime, JsRuntimeObjectRef jsRuntimeObjectRef, string memberName) { this.jsRuntime = jsRuntime; this.jsRuntimeObjectRef = jsRuntimeObjectRef; this.memberName = memberName; }
internal void SetJsRuntime(IJSRuntime jSRuntime, JsRuntimeObjectRef jsObjectRef) { this.jsObjectRef = jsObjectRef; this.jSRuntime = jSRuntime; }
/// <summary> /// Call the method on the js instance /// </summary> /// <param name="jsRuntime1">Curent JS Runtime</param> /// <param name="windowObject">Reference to the JS instance</param> /// <param name="methodName">Methdod name/path </param> /// <param name="arguments">method arguments</param> /// <returns></returns> public static async Task InvokeInstanceMethodAsync(this IJSRuntime jsRuntime, JsRuntimeObjectRef windowObject, string methodName, params object[] arguments) { await jsRuntime.InvokeVoidAsync("browserInterop.callInstanceMethod", new object[] { windowObject, methodName }.Concat(arguments).ToArray()); }
internal void SetJsRuntime(IJSRuntime jsRuntime, JsRuntimeObjectRef navigatorRef) { jSRuntime = jsRuntime; this.navigatorRef = navigatorRef; }
public BeforeUnloadEvent(IJSRuntime jsRuntime, JsRuntimeObjectRef jsRuntimeObjectRef) { this.jsRuntime = jsRuntime; this.jsRuntimeObjectRef = jsRuntimeObjectRef; }
/// <summary> /// Get the js object content /// </summary> /// <param name="jsRuntime1">Curent JS Runtime</param> /// <param name="windowObject">Reference to the JS instance</param> /// <returns></returns> public static async Task <T> GetInstanceContent <T>(this IJSRuntime jsRuntime, JsRuntimeObjectRef jsObject, bool deep) { var content = await jsRuntime.InvokeAsync <T>("browserInterop.returnInstance", jsObject, deep); return(content); }
internal FramesArrayInterop(JsRuntimeObjectRef jsRuntimeObjectRef, IJSRuntime jsRuntime) { this.jsRuntimeObjectRef = jsRuntimeObjectRef; this.jsRuntime = jsRuntime; }
/// <summary> /// Call the method on the js instance and return the reference to the js object /// </summary> /// <param name="jsRuntime1">Curent JS Runtime</param> /// <param name="windowObject">Reference to the JS instance</param> /// <param name="methodName">Methdod name/path </param> /// <param name="arguments">method arguments</param> /// <returns></returns> public static async Task <JsRuntimeObjectRef> InvokeInstanceMethodGetRefAsync(this IJSRuntime jsRuntime, JsRuntimeObjectRef windowObject, string methodName, params object[] arguments) { var jsRuntimeObjectRef = await jsRuntime.InvokeAsync <JsRuntimeObjectRef>("browserInterop.callInstanceMethodGetRef", new object[] { windowObject, methodName }.Concat(arguments).ToArray()); jsRuntimeObjectRef.JSRuntime = jsRuntime; return(jsRuntimeObjectRef); }
public static async Task <bool> HasProperty(this IJSRuntime jsRuntime, JsRuntimeObjectRef jsObject, string propertyPath) { return(await jsRuntime.InvokeAsync <bool>("browserInterop.hasProperty", jsObject, propertyPath)); }
/// <summary> /// Add an event listener to the given property and event Type /// </summary> /// <param name="jsRuntime"></param> /// <param name="jsRuntimeObject"></param> /// <param name="propertyName"></param> /// <param name="eventName"></param> /// <param name="callBack"></param> /// <returns></returns> public static async Task <IAsyncDisposable> AddEventListener(this IJSRuntime jsRuntime, JsRuntimeObjectRef jsRuntimeObject, string propertyName, string eventName, CallBackInteropWrapper callBack) { var listenerId = await jsRuntime.InvokeAsync <int>("browserInterop.addEventListener", jsRuntimeObject, propertyName, eventName, callBack); return(new ActionAsyncDisposable(async() => await jsRuntime.InvokeVoidAsync("browserInterop.removeEventListener", jsRuntimeObject, propertyName, eventName, listenerId))); }
internal WindowHistory(IJSRuntime jsRuntime, JsRuntimeObjectRef jsRuntimeObjectRef) { this.jsRuntime = jsRuntime; this.jsRuntimeObjectRef = jsRuntimeObjectRef; }
public virtual void SetJsRuntime(IJSRuntime jsRuntime, JsRuntimeObjectRef jsObjectRef) { this.JsRuntimeObjectRef = jsObjectRef; this.jsRuntime = jsRuntime; }