@nekm/svelte-core 1.10.0 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import {onMount} from "svelte";
|
|
3
3
|
import {browserImportScript} from "@nekm/core";
|
|
4
4
|
import {page} from "$app/state";
|
|
5
|
+
import { dev } from "$app/environment";
|
|
6
|
+
import { debug } from "node:console";
|
|
5
7
|
|
|
6
8
|
export interface GoogleAnalyticsProps {
|
|
7
9
|
/**
|
|
@@ -10,29 +12,20 @@
|
|
|
10
12
|
readonly id: string;
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
14
|
-
* this, then Google Analytics will send debug data only.
|
|
15
|
+
* Activate debug mode. Defaults to true during dev
|
|
15
16
|
*/
|
|
16
|
-
readonly
|
|
17
|
+
readonly debugMode?: boolean;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
readonly debug_mode?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const { id, productionDomain }: GoogleAnalyticsProps = $props();
|
|
20
|
+
const { id, debugMode = dev }: GoogleAnalyticsProps = $props();
|
|
24
21
|
|
|
25
22
|
const url = "https://www.googletagmanager.com";
|
|
26
23
|
|
|
27
|
-
const productionDomainStr = $derived(productionDomain instanceof URL ? productionDomain.hostname : productionDomain);
|
|
28
|
-
|
|
29
24
|
onMount(() => {
|
|
30
|
-
let config:
|
|
25
|
+
let config: { readonly debug_mode?: boolean } = { };
|
|
31
26
|
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
config = {};
|
|
35
|
-
}
|
|
27
|
+
if (debugMode) {
|
|
28
|
+
config = { debug_mode: true };
|
|
36
29
|
}
|
|
37
30
|
|
|
38
31
|
window.dataLayer = window.dataLayer || [];
|
|
@@ -4,10 +4,9 @@ export interface GoogleAnalyticsProps {
|
|
|
4
4
|
*/
|
|
5
5
|
readonly id: string;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* this, then Google Analytics will send debug data only.
|
|
7
|
+
* Activate debug mode. Defaults to true during dev
|
|
9
8
|
*/
|
|
10
|
-
readonly
|
|
9
|
+
readonly debugMode?: boolean;
|
|
11
10
|
}
|
|
12
11
|
declare const GoogleAnalytics: import("svelte").Component<GoogleAnalyticsProps, {}, "">;
|
|
13
12
|
type GoogleAnalytics = ReturnType<typeof GoogleAnalytics>;
|
package/dist/timer.svelte.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { interval
|
|
1
|
+
import { interval } from "@nekm/core";
|
|
2
2
|
export function effectTimer(waitMs, fn) {
|
|
3
3
|
$effect(() => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (!stop) {
|
|
7
|
-
await fn();
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
return () => {
|
|
11
|
-
stop = true;
|
|
12
|
-
};
|
|
4
|
+
const timeoutId = setTimeout(fn, waitMs);
|
|
5
|
+
return () => clearTimeout(timeoutId);
|
|
13
6
|
});
|
|
14
7
|
}
|
|
15
8
|
export function effectInterval(waitMs, fn) {
|
package/package.json
CHANGED