Skip to content

Commit e88296f

Browse files
committed
deprecte event$
1 parent 45ec5bf commit e88296f

File tree

13 files changed

+84
-60
lines changed

13 files changed

+84
-60
lines changed

.changeset/hip-lemons-move.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@builder.io/qwik': patch
3+
---
4+
5+
Deprecated event$, it will be removed in v2. Instead, use `$()`, and inside the function add `if (isServer) { return; }`

packages/docs/src/components/theme-toggle/theme-toggle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { component$, event$, useContext, useStyles$ } from '@builder.io/qwik';
1+
import { component$, $, useContext, useStyles$ } from '@builder.io/qwik';
22
import { SunAndMoon } from './sun-and-moon';
33
import { themeStorageKey } from '../router-head/theme-script';
44
import themeToggle from './theme-toggle.css?inline';
@@ -45,7 +45,7 @@ export const ThemeToggle = component$(() => {
4545
useStyles$(themeToggle);
4646
const state = useContext(GlobalStore);
4747

48-
const onClick$ = event$(() => {
48+
const onClick$ = $(() => {
4949
state.theme = state.theme === 'light' ? 'dark' : 'light';
5050
setPreference(state.theme);
5151
});

packages/docs/src/routes/api/qwik/api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@
819819
}
820820
],
821821
"kind": "Function",
822-
"content": "```typescript\nevent$: <T>(qrl: T) => QRL<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nqrl\n\n\n</td><td>\n\nT\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n\n**Returns:**\n\n[QRL](#qrl)<!-- -->&lt;T&gt;",
822+
"content": "> Warning: This API is now obsolete.\n> \n> It will be removed in v2. Instead, use `$()`<!-- -->, and inside the function add `if (isServer) { return; }`\n> \n\n\n```typescript\nevent$: <T>(qrl: T) => QRL<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nqrl\n\n\n</td><td>\n\nT\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n\n**Returns:**\n\n[QRL](#qrl)<!-- -->&lt;T&gt;",
823823
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/qrl/qrl.public.ts",
824824
"mdFile": "qwik.event_.md"
825825
},

packages/docs/src/routes/api/qwik/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,10 @@ any \| undefined
21762176
21772177
## event$
21782178
2179+
> Warning: This API is now obsolete.
2180+
>
2181+
> It will be removed in v2. Instead, use `$()`, and inside the function add `if (isServer) { return; }`
2182+
21792183
```typescript
21802184
event$: <T>(qrl: T) => QRL<T>;
21812185
```

packages/qwik-city/src/middleware/bun/middleware.bun.api.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,27 @@
33
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
44
55
```ts
6+
67
import type { ClientConn } from '@builder.io/qwik-city/middleware/request-handler';
78
import type { ServerRenderOptions } from '@builder.io/qwik-city/middleware/request-handler';
89

910
// @public (undocumented)
1011
export function createQwikCity(opts: QwikCityBunOptions): {
11-
router: (request: Request) => Promise<Response | null>;
12-
notFound: (request: Request) => Promise<Response>;
13-
staticFile: (request: Request) => Promise<Response | null>;
12+
router: (request: Request) => Promise<Response | null>;
13+
notFound: (request: Request) => Promise<Response>;
14+
staticFile: (request: Request) => Promise<Response | null>;
1415
};
1516

1617
// @public (undocumented)
1718
export interface QwikCityBunOptions extends ServerRenderOptions {
18-
// (undocumented)
19-
getClientConn?: (request: Request) => ClientConn;
20-
static?: {
21-
root?: string;
22-
cacheControl?: string;
23-
};
19+
// (undocumented)
20+
getClientConn?: (request: Request) => ClientConn;
21+
static?: {
22+
root?: string;
23+
cacheControl?: string;
24+
};
2425
}
2526

2627
// (No @packageDocumentation comment for this package)
28+
2729
```

packages/qwik-city/src/middleware/deno/middleware.deno.api.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,43 @@
33
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
44
55
```ts
6+
67
import type { ClientConn } from '@builder.io/qwik-city/middleware/request-handler';
78
import type { ServerRenderOptions } from '@builder.io/qwik-city/middleware/request-handler';
89

910
// @public (undocumented)
1011
export function createQwikCity(opts: QwikCityDenoOptions): {
11-
router: (request: Request, info: ServeHandlerInfo) => Promise<Response | null>;
12-
notFound: (request: Request) => Promise<Response>;
13-
staticFile: (request: Request) => Promise<Response | null>;
12+
router: (request: Request, info: ServeHandlerInfo) => Promise<Response | null>;
13+
notFound: (request: Request) => Promise<Response>;
14+
staticFile: (request: Request) => Promise<Response | null>;
1415
};
1516

1617
// @public (undocumented)
1718
export interface NetAddr {
18-
// (undocumented)
19-
hostname: string;
20-
// (undocumented)
21-
port: number;
22-
// (undocumented)
23-
transport: 'tcp' | 'udp';
19+
// (undocumented)
20+
hostname: string;
21+
// (undocumented)
22+
port: number;
23+
// (undocumented)
24+
transport: 'tcp' | 'udp';
2425
}
2526

2627
// @public (undocumented)
2728
export interface QwikCityDenoOptions extends ServerRenderOptions {
28-
// (undocumented)
29-
getClientConn?: (request: Request, info: ServeHandlerInfo) => ClientConn;
30-
static?: {
31-
root?: string;
32-
cacheControl?: string;
33-
};
29+
// (undocumented)
30+
getClientConn?: (request: Request, info: ServeHandlerInfo) => ClientConn;
31+
static?: {
32+
root?: string;
33+
cacheControl?: string;
34+
};
3435
}
3536

3637
// @public (undocumented)
3738
export interface ServeHandlerInfo {
38-
// (undocumented)
39-
remoteAddr: NetAddr;
39+
// (undocumented)
40+
remoteAddr: NetAddr;
4041
}
4142

4243
// (No @packageDocumentation comment for this package)
44+
4345
```

packages/qwik-city/src/runtime/src/service-worker/qwik-city.service-worker.api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
44
55
```ts
6+
67
// @public @deprecated (undocumented)
78
export const setupServiceWorker: () => void;
89

910
// (No @packageDocumentation comment for this package)
11+
1012
```

packages/qwik-city/src/runtime/src/spa-init.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import type { ClientSPAWindow } from './qwik-city-component';
22
import type { ScrollHistoryState } from './scroll-restoration';
33
import type { ScrollState } from './types';
44

5-
import { isDev } from '@builder.io/qwik';
6-
import { event$ } from '@builder.io/qwik';
5+
import { isDev, isServer } from '@builder.io/qwik';
6+
import { $ } from '@builder.io/qwik';
77

88
// TODO Dedupe handler code from here and QwikCityProvider?
99
// TODO Navigation API; check for support & simplify.
@@ -14,13 +14,18 @@ import { event$ } from '@builder.io/qwik';
1414
// - Robust, fully relies only on history. (scrollRestoration = 'manual')
1515

1616
// ! DO NOT IMPORT OR USE ANY EXTERNAL REFERENCES IN THIS SCRIPT.
17-
export default event$((_: Event, el: Element) => {
17+
export default $((_: Event, el: Element) => {
1818
const win: ClientSPAWindow = window;
1919
const spa = '_qCitySPA';
2020
const initPopstate = '_qCityInitPopstate';
2121
const initAnchors = '_qCityInitAnchors';
2222
const initVisibility = '_qCityInitVisibility';
2323
const initScroll = '_qCityInitScroll';
24+
25+
if (isServer) {
26+
return;
27+
}
28+
2429
if (
2530
!win[spa] &&
2631
!win[initPopstate] &&

packages/qwik-city/src/static/qwik-city.static.api.md

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
44
55
```ts
6+
67
/// <reference types="node" />
78

89
import type { RenderOptions } from '@builder.io/qwik/server';
@@ -12,39 +13,40 @@ export function generate(opts: StaticGenerateOptions): Promise<StaticGenerateRes
1213

1314
// @public (undocumented)
1415
export interface StaticGenerateOptions extends StaticGenerateRenderOptions {
15-
basePathname?: string;
16-
qwikCityPlanModulePath: string;
17-
renderModulePath: string;
18-
// (undocumented)
19-
rootDir?: string;
16+
basePathname?: string;
17+
qwikCityPlanModulePath: string;
18+
renderModulePath: string;
19+
// (undocumented)
20+
rootDir?: string;
2021
}
2122

2223
// @public (undocumented)
2324
export interface StaticGenerateRenderOptions extends RenderOptions {
24-
emit404Pages?: boolean;
25-
emitData?: boolean;
26-
emitHtml?: boolean;
27-
exclude?: string[];
28-
include?: string[];
29-
log?: 'debug';
30-
maxTasksPerWorker?: number;
31-
maxWorkers?: number;
32-
origin: string;
33-
outDir: string;
34-
sitemapOutFile?: string | null;
25+
emit404Pages?: boolean;
26+
emitData?: boolean;
27+
emitHtml?: boolean;
28+
exclude?: string[];
29+
include?: string[];
30+
log?: 'debug';
31+
maxTasksPerWorker?: number;
32+
maxWorkers?: number;
33+
origin: string;
34+
outDir: string;
35+
sitemapOutFile?: string | null;
3536
}
3637

3738
// @public (undocumented)
3839
export interface StaticGenerateResult {
39-
// (undocumented)
40-
duration: number;
41-
// (undocumented)
42-
errors: number;
43-
// (undocumented)
44-
rendered: number;
45-
// (undocumented)
46-
staticPaths: string[];
40+
// (undocumented)
41+
duration: number;
42+
// (undocumented)
43+
errors: number;
44+
// (undocumented)
45+
rendered: number;
46+
// (undocumented)
47+
staticPaths: string[];
4748
}
4849

4950
// (No @packageDocumentation comment for this package)
51+
5052
```

packages/qwik/src/build/qwik.build.api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
44
55
```ts
6+
67
// @public
78
export const isBrowser: boolean;
89

@@ -13,4 +14,5 @@ export const isDev: boolean;
1314
export const isServer: boolean;
1415

1516
// (No @packageDocumentation comment for this package)
17+
1618
```

0 commit comments

Comments
 (0)