/// <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);
        }
Esempio n. 2
0
 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);
 }
Esempio n. 4
0
        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;
 }
Esempio n. 8
0
 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;
 }
Esempio n. 10
0
 internal WindowConsole(IJSRuntime jsRuntime, JsRuntimeObjectRef windowObject)
 {
     this.jsRuntime    = jsRuntime;
     this.windowObject = windowObject;
 }
Esempio n. 11
0
 internal BarProp(JsRuntimeObjectRef windowRef, string propertyName, IJSRuntime jsRuntime)
 {
     this.windowRef    = windowRef;
     this.propertyName = propertyName;
     this.jsRuntime    = jsRuntime;
 }
Esempio n. 12
0
 internal void SetJsRuntime(IJSRuntime jsRuntime, JsRuntimeObjectRef propertyRef)
 {
     this.jsRuntime = jsRuntime;
     this.windowRef = propertyRef;
 }
Esempio n. 13
0
 internal HistoryInterop(IJSRuntime jsRuntime, JsRuntimeObjectRef jsRuntimeObjectRef)
 {
     this.jsRuntime          = jsRuntime;
     this.jsRuntimeObjectRef = jsRuntimeObjectRef;
 }
Esempio n. 14
0
 internal StorageInterop(IJSRuntime jsRuntime, JsRuntimeObjectRef jsRuntimeObjectRef, string memberName)
 {
     this.jsRuntime          = jsRuntime;
     this.jsRuntimeObjectRef = jsRuntimeObjectRef;
     this.memberName         = memberName;
 }
Esempio n. 15
0
 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());
 }
Esempio n. 17
0
 internal void SetJsRuntime(IJSRuntime jsRuntime, JsRuntimeObjectRef navigatorRef)
 {
     jSRuntime         = jsRuntime;
     this.navigatorRef = navigatorRef;
 }
Esempio n. 18
0
 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);
        }
Esempio n. 20
0
 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)));
        }
Esempio n. 24
0
 internal WindowHistory(IJSRuntime jsRuntime, JsRuntimeObjectRef jsRuntimeObjectRef)
 {
     this.jsRuntime          = jsRuntime;
     this.jsRuntimeObjectRef = jsRuntimeObjectRef;
 }
Esempio n. 25
0
 public virtual void SetJsRuntime(IJSRuntime jsRuntime, JsRuntimeObjectRef jsObjectRef)
 {
     this.JsRuntimeObjectRef = jsObjectRef;
     this.jsRuntime          = jsRuntime;
 }