// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; using System.Collections.Generic; namespace Microsoft.ClearScript { ///

/// Represents a script object. /// public interface IScriptObject : IDisposable, IAsyncDisposable { /// /// Gets the script engine that owns the object. /// ScriptEngine Engine { get; } /// /// Gets the value of a named script object property. /// /// The name of the property to get. /// Optional arguments for property retrieval. /// The value of the specified property. object GetProperty(string name, params object[] args); /// /// Sets the value of a named script object property. /// /// The name of the property to set. /// An array containing optional arguments and the new property value. /// /// The array must contain at least one element. The new /// property value must be the last element of the array. /// void SetProperty(string name, params object[] args); /// /// Removes a named script object property. /// /// The name of the property to remove. /// True if the property was removed, false otherwise. bool DeleteProperty(string name); /// /// Enumerates the script object's property names. /// IEnumerable PropertyNames { get; } /// /// Gets or sets the value of a named script object property. /// /// The name of the property to get or set. /// Optional arguments for property access. /// The value of the specified property. object this[string name, params object[] args] { get; set; } /// /// Gets the value of an indexed script object property. /// /// The index of the property to get. /// The value of the specified property. object GetProperty(int index); /// /// Sets the value of an indexed script object property. /// /// The index of the property to set. /// The new property value. void SetProperty(int index, object value); /// /// Removes an indexed script object property. /// /// The index of the property to remove. /// True if the property was removed, false otherwise. bool DeleteProperty(int index); /// /// Enumerates the script object's property indices. /// IEnumerable PropertyIndices { get; } /// /// Gets or sets the value of an indexed script object property. /// /// The index of the property to get or set. /// The value of the specified property. object this[int index] { get; set; } /// /// Invokes the script object. /// /// True to invoke the object as a constructor, false otherwise. /// Optional arguments for object invocation. /// The invocation result value. object Invoke(bool asConstructor, params object[] args); /// /// Invokes a script object method. /// /// The name of the method to invoke. /// Optional arguments for method invocation. /// The invocation result value. object InvokeMethod(string name, params object[] args); /// /// Invokes the script object as a function. /// /// Optional arguments for object invocation. /// The invocation result value. object InvokeAsFunction(params object[] args); } }