コード例 #1
0
 protected override string?InvokeJS(string identifier, string?argsJson, JSCallResultType resultType, long targetInstanceId)
 {
     InvokeCalls.Add(new InvokeArgs {
         Identifier = identifier, ArgsJson = argsJson
     });
     return(NextResultJson);
 }
コード例 #2
0
        /// <inheritdoc />
        protected override string InvokeJS(string identifier, string?argsJson, JSCallResultType resultType, long targetInstanceId)
        {
            var callInfo = new JSCallInfo
            {
                FunctionIdentifier        = identifier,
                TargetInstanceId          = targetInstanceId,
                ResultType                = resultType,
                MarshalledCallArgsJson    = argsJson ?? "[]",
                MarshalledCallAsyncHandle = default
            };

            var result = InternalCalls.InvokeJS <object, object, object, string>(out var exception, ref callInfo, null, null, null);

            return(exception != null
                ? throw new JSException(exception)
                : result);
        }
コード例 #3
0
ファイル: JSRuntime.cs プロジェクト: xrascal/aspnetcore
 /// <summary>
 /// Begins an asynchronous function invocation.
 /// </summary>
 /// <param name="taskId">The identifier for the function invocation, or zero if no async callback is required.</param>
 /// <param name="identifier">The identifier for the function to invoke.</param>
 /// <param name="argsJson">A JSON representation of the arguments.</param>
 /// <param name="resultType">The type of result expected from the invocation.</param>
 /// <param name="targetInstanceId">The instance ID of the target JS object.</param>
 protected abstract void BeginInvokeJS(long taskId, string identifier, string?argsJson, JSCallResultType resultType, long targetInstanceId);
コード例 #4
0
        protected override string?InvokeJS(string identifier, string?argsJson, JSCallResultType resultType, long targetInstanceId)
        {
            InvokeJSInvocationCount++;

            return(null);
        }
コード例 #5
0
 protected override void BeginInvokeJS(long taskId, string identifier, string?argsJson, JSCallResultType resultType, long targetInstanceId)
 {
     BeginInvokeJSInvocationCount++;
 }
コード例 #6
0
ファイル: TestJSRuntime.cs プロジェクト: zzl1010/aspnetcore
 protected override void BeginInvokeJS(long asyncHandle, string identifier, string?argsJson, JSCallResultType resultType, long targetInstanceId)
 {
     throw new NotImplementedException();
 }
コード例 #7
0
        /// <inheritdoc />
        protected override void BeginInvokeJS(long asyncHandle, string identifier, string?argsJson, JSCallResultType resultType, long targetInstanceId)
        {
            var callInfo = new JSCallInfo
            {
                FunctionIdentifier        = identifier,
                TargetInstanceId          = targetInstanceId,
                ResultType                = resultType,
                MarshalledCallArgsJson    = argsJson ?? "[]",
                MarshalledCallAsyncHandle = asyncHandle
            };

            InternalCalls.InvokeJS <object, object, object, string>(out _, ref callInfo, null, null, null);
        }
コード例 #8
0
ファイル: IpcSender.cs プロジェクト: shat90/aspnetcore
 public void BeginInvokeJS(long taskId, string identifier, string argsJson, JSCallResultType resultType, long targetInstanceId)
 {
     DispatchMessageWithErrorHandling(IpcCommon.Serialize(IpcCommon.OutgoingMessageType.BeginInvokeJS, taskId, identifier, argsJson, resultType, targetInstanceId));
 }
コード例 #9
0
 protected override void BeginInvokeJS(long taskId, string identifier, string argsJson, JSCallResultType resultType, long targetInstanceId)
 {
     _ipcSender.BeginInvokeJS(taskId, identifier, argsJson, resultType, targetInstanceId);
 }
コード例 #10
0
 protected override void BeginInvokeJS(long asyncHandle, string identifier, string?argsJson, JSCallResultType resultType, long targetInstanceId)
 => throw new NotImplementedException("This test only covers sync calls");
コード例 #11
0
 protected override void BeginInvokeJS(long taskId, string identifier, string argsJson, JSCallResultType resultType, long targetInstanceId)
 {
     throw new NotSupportedException();
 }
コード例 #12
0
    protected override void BeginInvokeJS(long taskId, string identifier, string argsJson, JSCallResultType resultType, long targetInstanceId)
    {
        if (_ipcSender is null)
        {
            throw new InvalidOperationException("Cannot invoke JavaScript outside of a WebView context.");
        }

        _ipcSender.BeginInvokeJS(taskId, identifier, argsJson, resultType, targetInstanceId);
    }
コード例 #13
0
 protected override void BeginInvokeJS(long taskId, string identifier, string argsJson, JSCallResultType resultType, long targetInstanceId)
 {
     Called.Set();
 }