format
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"name": "space-stream",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"build": "spacetime build",
|
||||
"publish": "spacetime publish"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"spacetimedb": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "~5.6.2"
|
||||
}
|
||||
}
|
||||
"name": "space-stream",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"build": "spacetime build",
|
||||
"publish": "spacetime publish"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"spacetimedb": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "~5.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,34 @@
|
||||
import { schema, table, t } from 'spacetimedb/server';
|
||||
import { schema, table, t } from "spacetimedb/server";
|
||||
|
||||
const spacetimedb = schema({
|
||||
person: table(
|
||||
{ public: true },
|
||||
{
|
||||
name: t.string(),
|
||||
}
|
||||
),
|
||||
person: table(
|
||||
{ public: true },
|
||||
{
|
||||
name: t.string(),
|
||||
},
|
||||
),
|
||||
});
|
||||
export default spacetimedb;
|
||||
|
||||
export const init = spacetimedb.init(_ctx => {
|
||||
// Called when the module is initially published
|
||||
export const init = spacetimedb.init((_ctx) => {
|
||||
// Called when the module is initially published
|
||||
});
|
||||
|
||||
export const onConnect = spacetimedb.clientConnected(_ctx => {
|
||||
// Called every time a new client connects
|
||||
export const onConnect = spacetimedb.clientConnected((_ctx) => {
|
||||
// Called every time a new client connects
|
||||
});
|
||||
|
||||
export const onDisconnect = spacetimedb.clientDisconnected(_ctx => {
|
||||
// Called every time a client disconnects
|
||||
export const onDisconnect = spacetimedb.clientDisconnected((_ctx) => {
|
||||
// Called every time a client disconnects
|
||||
});
|
||||
|
||||
export const add = spacetimedb.reducer(
|
||||
{ name: t.string() },
|
||||
(ctx, { name }) => {
|
||||
ctx.db.person.insert({ name });
|
||||
}
|
||||
);
|
||||
|
||||
export const sayHello = spacetimedb.reducer(ctx => {
|
||||
for (const person of ctx.db.person.iter()) {
|
||||
console.info(`Hello, ${person.name}!`);
|
||||
}
|
||||
console.info('Hello, World!');
|
||||
export const add = spacetimedb.reducer({ name: t.string() }, (ctx, { name }) => {
|
||||
ctx.db.person.insert({ name });
|
||||
});
|
||||
|
||||
export const sayHello = spacetimedb.reducer((ctx) => {
|
||||
for (const person of ctx.db.person.iter()) {
|
||||
console.info(`Hello, ${person.name}!`);
|
||||
}
|
||||
console.info("Hello, World!");
|
||||
});
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
* some options are required by SpacetimeDB.
|
||||
*/
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "bundler",
|
||||
"jsx": "react-jsx",
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "bundler",
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* The following options are required by SpacetimeDB
|
||||
* and should not be modified
|
||||
*/
|
||||
"target": "ESNext",
|
||||
"lib": ["ES2021", "dom"],
|
||||
"module": "ESNext",
|
||||
"isolatedModules": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["./**/*"]
|
||||
/* The following options are required by SpacetimeDB
|
||||
* and should not be modified
|
||||
*/
|
||||
"target": "ESNext",
|
||||
"lib": ["ES2021", "dom"],
|
||||
"module": "ESNext",
|
||||
"isolatedModules": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["./**/*"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user