Add another <script> below that which then uses $.connection et cetera.
Now, I'm needing to use signalr-no-jquery in a project that doesn't have an existing JavaScript build process (beyond MSBuild/Visual Studio's built-in TypeScript compilation) and I'm stuck.
I was under the impression that signalr-no-jquery is a drop-in replacement for both jquery-2.2.4.min.js and jquery.signalr.2.4.1.js, but when I did npm install --save signalr-no-jquery@0.2.0 I saw that the node_modules/signalr-no-jquery/build directory contained 2 files:
jQueryShim.js
signalR.js
and when I looked inside of those files, I saw they were both used require(), module.exports, and Object.defineProperty(exports, "__esModule" ), { etc } which means I can't use these files directly in a web-page (I think? please correct me if I'm wrong). And why is jQueryShim.js a separate file? I thought the whole point of signalr-no-jquery was that the jQuery shim is embedded within the signalr-no-jquery script file?
the documentation page says to just use import { hubConnection } from 'signalr-no-jquery, but I can't do that because:
My web-application needs to support browsers that don't support <script type="module">.
from 'signalr-no-jquery' won't work anyway because there is no file named signalr-no-jquery/index.js.
And as said above, require(), module, and exports can't be used in client-code.
So how do I actually use signalr-no-jquery with a traditional SSR web-application without a JavaScript build process?
(I'd like to preface this post with a huge "thank you" for recently updating the library for SignalR 2.4.1 - that was only a few hours ago!)
In the old world, using the original SignalR client library is straightforward:
jquery-2.2.4.min.js
andjquery.signalr.2.4.1.js
in your/scripts/
directory.Site.master
,_Layout.cshtml
,index.html
, etc).Add this to your
<head>
:<script>
below that which then uses$.connection
et cetera.Now, I'm needing to use
signalr-no-jquery
in a project that doesn't have an existing JavaScript build process (beyond MSBuild/Visual Studio's built-in TypeScript compilation) and I'm stuck.I was under the impression that
signalr-no-jquery
is a drop-in replacement for bothjquery-2.2.4.min.js
andjquery.signalr.2.4.1.js
, but when I didnpm install --save signalr-no-jquery@0.2.0
I saw that thenode_modules/signalr-no-jquery/build
directory contained 2 files:jQueryShim.js
signalR.js
and when I looked inside of those files, I saw they were both used
require()
,module.exports
, andObject.defineProperty(exports, "__esModule" ), { etc }
which means I can't use these files directly in a web-page (I think? please correct me if I'm wrong). And why isjQueryShim.js
a separate file? I thought the whole point ofsignalr-no-jquery
was that the jQuery shim is embedded within thesignalr-no-jquery
script file?the documentation page says to just use
import { hubConnection } from 'signalr-no-jquery
, but I can't do that because:<script type="module">
.from 'signalr-no-jquery'
won't work anyway because there is no file namedsignalr-no-jquery/index.js
.require()
,module
, andexports
can't be used in client-code.So how do I actually use
signalr-no-jquery
with a traditional SSR web-application without a JavaScript build process?I just want something like this: