@dereekb/browser 0.0.1
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.
- package/README.md +11 -0
- package/package.json +7 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -0
- package/src/lib/window.d.ts +7 -0
- package/src/lib/window.js +25 -0
- package/src/lib/window.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/window';
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/browser/src/index.ts"],"names":[],"mappings":";;;AAAA,4DAA6B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether or not the current host is localhost. Useful for determining local dev environments.
|
|
3
|
+
*/
|
|
4
|
+
export declare function isLocalhost(): boolean;
|
|
5
|
+
export declare function makeWindowPath(path: string): string;
|
|
6
|
+
export declare function getBaseWindowUrl(): string;
|
|
7
|
+
export declare function getWindowPathNameWithQuery(): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// MARK: Window Location Utiltiies
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getWindowPathNameWithQuery = exports.getBaseWindowUrl = exports.makeWindowPath = exports.isLocalhost = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Whether or not the current host is localhost. Useful for determining local dev environments.
|
|
7
|
+
*/
|
|
8
|
+
function isLocalhost() {
|
|
9
|
+
return window.location.hostname === 'localhost';
|
|
10
|
+
}
|
|
11
|
+
exports.isLocalhost = isLocalhost;
|
|
12
|
+
function makeWindowPath(path) {
|
|
13
|
+
return `${getBaseWindowUrl()}${path}`;
|
|
14
|
+
}
|
|
15
|
+
exports.makeWindowPath = makeWindowPath;
|
|
16
|
+
function getBaseWindowUrl() {
|
|
17
|
+
const port = (window.location.port) ? (':' + window.location.port) : '';
|
|
18
|
+
return `${window.location.protocol}//${window.location.hostname}${port}`;
|
|
19
|
+
}
|
|
20
|
+
exports.getBaseWindowUrl = getBaseWindowUrl;
|
|
21
|
+
function getWindowPathNameWithQuery() {
|
|
22
|
+
return window.location.pathname + window.location.search;
|
|
23
|
+
}
|
|
24
|
+
exports.getWindowPathNameWithQuery = getWindowPathNameWithQuery;
|
|
25
|
+
//# sourceMappingURL=window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../../../../packages/browser/src/lib/window.ts"],"names":[],"mappings":";AACA,kCAAkC;;;AAElC;;GAEG;AACH,SAAgB,WAAW;IACzB,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,WAAW,CAAC;AAClD,CAAC;AAFD,kCAEC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,GAAG,gBAAgB,EAAE,GAAG,IAAI,EAAE,CAAC;AACxC,CAAC;AAFD,wCAEC;AAED,SAAgB,gBAAgB;IAC9B,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,EAAE,CAAC;AAC3E,CAAC;AAHD,4CAGC;AAED,SAAgB,0BAA0B;IACxC,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC3D,CAAC;AAFD,gEAEC"}
|