Global Variables
Wujie injects several global variables onto the sub-app's window object:
declare global {
interface Window {
// Whether running inside Wujie
__POWERED_BY_WUJIE__?: boolean;
// Public base URL of the sub-app
__WUJIE_PUBLIC_PATH__: string;
// Native unproxied querySelector
__WUJIE_RAW_DOCUMENT_QUERY_SELECTOR__: typeof Document.prototype.querySelector;
// Native unproxied querySelectorAll
__WUJIE_RAW_DOCUMENT_QUERY_SELECTOR_ALL__: typeof Document.prototype.querySelectorAll;
// Native unproxied window object
__WUJIE_RAW_WINDOW__: Window;
// Sub-app sandbox instance
__WUJIE: WuJie;
// Sub-app mount lifecycle function
__WUJIE_MOUNT: () => void;
// Sub-app unmount lifecycle function
__WUJIE_UNMOUNT: () => void | Promise<void>;
// Injected Wujie runtime object
$wujie: {
bus: EventBus;
shadowRoot?: ShadowRoot;
props?: { [key: string]: any };
location?: Object;
};
}
}
__POWERED_BY_WUJIE__
Type:
booleanDescription: Indicates whether the sub-app is currently running inside a Wujie micro-frontend environment.
__WUJIE_PUBLIC_PATH__
Type:
stringDescription: The public base path of the sub-app.
__WUJIE_RAW_DOCUMENT_QUERY_SELECTOR__
Type:
typeof Document.prototype.querySelectorDescription: Because the sub-app's
document.querySelectoris proxied to the Web Component ShadowRoot, use this variable when you need the original unproxiedquerySelector.
__WUJIE_RAW_DOCUMENT_QUERY_SELECTOR_ALL__
Type:
typeof Document.prototype.querySelectorAllDescription: Because the sub-app's
document.querySelectorAllis proxied to the Web Component ShadowRoot, use this variable when you need the original unproxiedquerySelectorAll.
__WUJIE_RAW_WINDOW__
Type:
WindowDescription: The sub-app's native, unproxied
windowobject.
__WUJIE
Type:
WuJieDescription: Internal Wujie sandbox instance for the sub-app. Application code should not rely on internal properties directly.
__WUJIE_MOUNT
Type:
FunctionDescription: User-defined sub-app mount lifecycle hook.
__WUJIE_UNMOUNT
Type:
FunctionDescription: User-defined sub-app unmount lifecycle hook.
$wujie
See $wujie API.
