sveltacular 0.0.60 → 0.0.61

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.
@@ -1,14 +1,17 @@
1
1
  import { browser } from '$app/environment';
2
2
  export const navigateToAnchor = (anchor) => {
3
- if (browser) {
4
- setTimeout(() => {
5
- if (window.top)
6
- window.top.location.hash = anchor;
7
- else
8
- window.location.href = anchor;
9
- }, 0);
10
- }
3
+ if (!browser)
4
+ return;
5
+ setTimeout(() => {
6
+ if (window.top)
7
+ window.top.location.hash = anchor;
8
+ else
9
+ window.location.href = anchor;
10
+ }, 0);
11
11
  };
12
12
  export const getAnchor = () => {
13
- return browser ? window.location.hash : null;
13
+ if (!browser)
14
+ return null;
15
+ const hash = window.top ? window.top.location.hash : window.location.hash;
16
+ return hash ? hash.slice(1) : null;
14
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltacular",
3
- "version": "0.0.60",
3
+ "version": "0.0.61",
4
4
  "description": "A Svelte component library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",