Add js web stuff to landing page + documentation
This commit is contained in:
12
go/jsruntime/runtime/solid-js/web/storage/dist/storage.cjs
vendored
Normal file
12
go/jsruntime/runtime/solid-js/web/storage/dist/storage.cjs
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var node_async_hooks = require('node:async_hooks');
|
||||
var web = require('solid-js/web');
|
||||
|
||||
function provideRequestEvent(init, cb) {
|
||||
if (!web.isServer) throw new Error("Attempting to use server context in non-server build");
|
||||
const ctx = globalThis[web.RequestContext] = globalThis[web.RequestContext] || new node_async_hooks.AsyncLocalStorage();
|
||||
return ctx.run(init, cb);
|
||||
}
|
||||
|
||||
exports.provideRequestEvent = provideRequestEvent;
|
||||
10
go/jsruntime/runtime/solid-js/web/storage/dist/storage.js
vendored
Normal file
10
go/jsruntime/runtime/solid-js/web/storage/dist/storage.js
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { AsyncLocalStorage } from 'node:async_hooks';
|
||||
import { isServer, RequestContext } from 'solid-js/web';
|
||||
|
||||
function provideRequestEvent(init, cb) {
|
||||
if (!isServer) throw new Error("Attempting to use server context in non-server build");
|
||||
const ctx = globalThis[RequestContext] = globalThis[RequestContext] || new AsyncLocalStorage();
|
||||
return ctx.run(init, cb);
|
||||
}
|
||||
|
||||
export { provideRequestEvent };
|
||||
Reference in New Issue
Block a user