Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit d524f0c

Browse files
author
G
committed
format
1 parent 14d31b2 commit d524f0c

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,26 @@ Add a file at `desktop/index.js` to run the electron app. The `initRemix` functi
2424

2525
```ts
2626
// desktop/index.js
27-
const { initRemix } = require("remix-electron");
28-
const { app, BrowserWindow } = require("electron");
29-
const { join } = require("node:path");
27+
const { initRemix } = require("remix-electron")
28+
const { app, BrowserWindow } = require("electron")
29+
const { join } = require("node:path")
3030

3131
/** @type {BrowserWindow | undefined} */
32-
let win;
32+
let win
3333

3434
app.on("ready", async () => {
3535
try {
3636
const url = await initRemix({
3737
serverBuild: join(process.cwd(), "build/index.js"),
38-
});
38+
})
3939

40-
win = new BrowserWindow({ show: false });
41-
await win.loadURL(url);
42-
win.show();
40+
win = new BrowserWindow({ show: false })
41+
await win.loadURL(url)
42+
win.show()
4343
} catch (error) {
44-
console.error(error);
44+
console.error(error)
4545
}
46-
});
46+
})
4747
```
4848

4949
Build the app with `npm run build`, then run `npx electron desktop/index.js` to start the app! 🚀
@@ -56,18 +56,18 @@ To circumvent this, create a `electron.server.ts` file, which re-exports from el
5656

5757
```ts
5858
// app/electron.server.ts
59-
import electron from "electron";
60-
export default electron;
59+
import electron from "electron"
60+
export default electron
6161
```
6262

6363
```ts
6464
// app/routes/_index.tsx
65-
import electron from "~/electron.server";
65+
import electron from "~/electron.server"
6666

6767
export function loader() {
6868
return {
6969
userDataPath: electron.app.getPath("userData"),
70-
};
70+
}
7171
}
7272
```
7373

@@ -82,7 +82,7 @@ function createWindow() {
8282
webPreferences: {
8383
nodeIntegration: true,
8484
},
85-
});
85+
})
8686
}
8787
```
8888

@@ -110,17 +110,17 @@ Options:
110110
**app/context.ts**
111111

112112
```ts
113-
import type * as remix from "@remix-run/node";
113+
import type * as remix from "@remix-run/node"
114114

115115
// your context type
116116
export type LoadContext = {
117-
secret: string;
118-
};
117+
secret: string
118+
}
119119

120120
// a custom data function args type to use for loaders/actions
121121
export type DataFunctionArgs = Omit<remix.DataFunctionArgs, "context"> & {
122-
context: LoadContext;
123-
};
122+
context: LoadContext
123+
}
124124
```
125125
126126
**desktop/main.js**
@@ -133,13 +133,13 @@ const url = await initRemix({
133133
getLoadContext: () => ({
134134
secret: "123",
135135
}),
136-
});
136+
})
137137
```
138138

139139
In a route file:
140140

141141
```ts
142-
import type { DataFunctionArgs, LoadContext } from "~/context";
142+
import type { DataFunctionArgs, LoadContext } from "~/context"
143143

144144
export async function loader({ context }: DataFunctionArgs) {
145145
// do something with context

workspaces/remix-electron/src/index.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export async function initRemix({
6161
typeof buildPath === "string"
6262
? /** @type {ServerBuild} */ await import(
6363
esm ? `${buildPath}?${Date.now()}` : buildPath
64-
)
64+
)
6565
: serverBuildOption
6666

6767
await app.whenReady()

0 commit comments

Comments
 (0)