Skip to content

Commit

Permalink
Name updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Aug 30, 2024
1 parent b62504a commit 191a771
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Positron/Controls/PositronWebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public PositronWebView()
Context = JSContextFactory.Instance.Create();
this.Clr = new GlobalClr();

Context["clr"] = Context.Marshal(Clr);

// Need to invoke TSLib in the global context...
Context.Evaluate(Scripts.TSLib, "tslib.js");

Context["clr"] = Context.Marshal(Clr);

Context["serialize"] = Context.CreateFunction(1, (c, s) => {
try
{
Expand Down
2 changes: 1 addition & 1 deletion Positron/Core/GlobalClr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public GlobalClr()
{
}

public Assembly? Resolve(string assemblyName)
public Assembly? ResolveAssembly(string assemblyName)
{
return Assembly.Load(assemblyName);
}
Expand Down
13 changes: 13 additions & 0 deletions Positron/Resources/TSLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,16 @@ function __web_atoms_create_promise() {
});
return { r, e, promise };
}

global.assemblyCache = {};
global.typeCache = {};

// lets bind clr.resolve to give assembly...
global.clr.resolve = function (name) {
return global.assemblyCache[name] ||= new Proxy({}, {
get(n) {
const fullName = `${n}, ${name}`;
return global.typeCache[fullName] ||= global.clr.resolveType(fullName);
}
});
}

0 comments on commit 191a771

Please sign in to comment.