Skip to content

Provide a way to access script document information from host methods #682

@ClearScriptLib

Description

@ClearScriptLib

Discussed in #667

Originally posted by cyraid July 26, 2025
In a C# method, calling from Javascript, is there a way to get Module (Document) information? I have a Javascript Plugin System that works off of a single V8 Engine (so that plugins can import Modules from other plugins).

It would be nice if something like this existed:

public static class SomeClass {
  [ScriptMember("someMethod")]
  public static void SomeMethod(V8DataOfSomeSort v8Data) {
    // v8Data.CurrentDocument.HostData
  } // Procedure //
} // Class //

//...

engine.AddHostType(typeof(SomeClass));

// Execute engine Module stuff here, then tie in a "HostData" (the plugin instance) to the Module on the C# side.

In Javascript (let's say were are in a Module):

SomeClass.someMethod();

I have a logging system, and it would be nice having which plugin the debug information is coming from when it outputs to the logging view.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions