title: How and where JsInterop javascript side implemented in a Blazor Server App?
body: <p><strong>Context</strong></p>
  
  <p>I am trying to understand how and where JsInterop <em>javascript side</em> implemented.</p>
  
  <p>Given the following sample code in my Blazor Server project:</p>
  
  <pre><code>public static ValueTask&lt;string&gt; Prompt(IJSRuntime jsRuntime, string message)
  {
      // Implemented in exampleJsInterop.js
      return jsRuntime.InvokeAsync&lt;string&gt;(
      "exampleJsFunctions.showPrompt",
      message);
  }
  </code></pre>
  
  <p>and its javascript counterpart:</p>
  
  <pre><code>window.exampleJsFunctions = {
    showPrompt: function (message) {
      return prompt(message, 'Type anything here');
    }
  };
  </code></pre>
  
  <p>(I <em>do understand</em> the SignalR infra and its use for the concept of circuits, I do understand circuits are used for two way client server communication in a Blazor Server project.)</p>
  
  <p><strong>Question</strong></p>
  
  <p>The only client side script what the project uses is: <code>&lt;script src="_framework/blazor.server.js"&gt;&lt;/script&gt;</code> As far as understand all javascript execution dispatch functionality should be there.
  I supposed the only way to accomplish the javascript call from the server side is some javascript eval() functionality. I tried to locate the source code _framework/blazor.server.js and I suppose it is here <a href="https://github.com/dotnet/aspnetcore/tree/v3.1.2/src/Components/Web.JS" rel="nofollow noreferrer">here in github</a>, because its build output in the /dist folder contains the file blazor.server.js</p>
  
  <p>I tried to locate this part (where the javascript function <em>given by its name</em> coming from the server is executed) in the typescript sources, with no success. Could anyone point me to the right direction? Am I looking in the wrong place, or there is no eval()? </p>
  
  <p>*** edit: Meanwhile I learned that not only eval() plays here, actually it is the last chance, there is the <code>window["functionName"](arguments);</code> too, and its variants. Still finding the relevant source lines...</p>