@mikezimm/fps-core-v7
Version:
Library of reusable core interfaces, types and constants migrated from fps-library-v2
34 lines (31 loc) • 1.76 kB
TypeScript
export declare const CurrentProtocol: string;
export declare const CurrentProtocolLC: string;
export declare const CurrentTenant: string;
export declare const CurrentTenantLC: string;
export declare const CurrentHost: string;
export declare const CurrentHostLC: string;
export declare const CurrentHostName: string;
export declare const CurrentHostNameLC: string;
export declare const CurrentOrigin: string;
export declare const CurrentOriginLC: string;
export declare const CurrentHref: string;
export declare const CurrentHrefLC: string;
export declare const CurrentSiteAbsolute: string;
export declare const CurrentSiteAbsoluteLC: string;
export declare const CurrentPathname: string;
export declare const CurrentPathnameLC: string;
/**
* Benefits of Centralizing window.location.XYZ ( Per ChatGPT )
1. Performance Optimization
Accessing window.location.origin involves a DOM interaction each time it's used.
By defining a const, you access a cached value, which is faster than repeatedly querying the DOM.
2. Consistency
If the origin is calculated once and reused across your app, you ensure all modules reference the same value,
preventing discrepancies caused by runtime changes.
3. Minification
During minification, a single const ensures the variable name is shortened across your app (e.g., CurrentOrigin might become a).
If you repeatedly inline window.location.origin, the minifier must keep the full property reference each time (e.g., window.location.origin).
4. Maintainability
Centralizing makes it easier to update the logic if your requirements change (e.g., including a fallback mechanism).
*/
//# sourceMappingURL=WindowLocationConstants.d.ts.map