예제 #1
0
        internal JSObjectReference(JSRuntime jsRuntime, long id)
        {
            _jsRuntime = jsRuntime;

            Id = id;
        }
예제 #2
0
 public ValueTask Reload(bool forceGet = false)
 => JSRuntime.InvokeVoidAsync("location.reload", forceGet);
예제 #3
0
 public ValueTask Print()
 => JSRuntime.InvokeVoidAsync("print");
예제 #4
0
 public ValueTask Close()
 => JSRuntime.InvokeVoidAsync("close");
예제 #5
0
 public ValueTask Alert(string message)
 => JSRuntime.InvokeVoidAsync("alert", message);
예제 #6
0
 public ValueTask <bool> Confirm(string message)
 => JSRuntime.InvokeAsync <bool>("confirm", message);
예제 #7
0
 /// <summary>
 /// 通过JS互操作直接写入document.cookie属性
 /// </summary>
 /// <param name="cookie">要写入的Cookie文本</param>
 /// <returns></returns>
 private ValueTask SetCookie(string cookie)
 => JSRuntime.SetProperty("document.cookie", cookie);
예제 #8
0
 /// <summary>
 /// 通过JS互操作直接读取document.cookie属性
 /// </summary>
 /// <returns></returns>
 private ValueTask <string> GetCookie()
 => JSRuntime.GetProperty <string>("document.cookie");
예제 #9
0
        public async Task <(bool Exist, string?Value)> TryGetValueAsync(string key)
        {
            var value = await JSRuntime.InvokeAsync <string?>("localStorage.getItem", key);

            return(value is { }, value);