// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
namespace Microsoft.JSInterop
{
///
/// Represents an instance of a JavaScript runtime to which calls may be dispatched.
///
public interface IJSRuntime
{
///
/// Invokes the specified JavaScript function asynchronously.
///
/// The JSON-serializable return type.
/// An identifier for the function to invoke. For example, the value "someScope.someFunction" will invoke the function window.someScope.someFunction.
/// JSON-serializable arguments.
/// An instance of obtained by JSON-deserializing the return value.
Task InvokeAsync(string identifier, params object[] args);
///
/// Stops tracking the .NET object represented by the .
/// This allows it to be garbage collected (if nothing else holds a reference to it)
/// and means the JS-side code can no longer invoke methods on the instance or pass
/// it as an argument to subsequent calls.
///
/// The reference to stop tracking.
/// This method is called automaticallly by .
void UntrackObjectRef(DotNetObjectRef dotNetObjectRef);
}
}