@wedgekit/embedded
v3.1.0
Published
## Purpose
Downloads
16
Maintainers
Keywords
Readme
@wedgekit/embedded
Purpose
@wedgekit/embedded
is a package for components to know if they are rendered in the Embedded Browser or not.
The Embedded Browser is the browser used in Classic Agility, the desktop application. It renders the web app in a browser nested within an application window.
Some features and behaviors should only be available within the embedded browser, or only availalbe outside the embedded browser.
Use
Browser
import React, { useState } from 'react';
import { useIsEmbedded } from '@wedgekit/embedded';
const Demo = () => {
const isEmbedded = useIsEmbedded();
return (
<>
{isEmbedded ? (
<h1>You are in the embedded browser!<h1>
) : (
<h1>You are NOT in the embedded browser!<h1>
)}
</>
);
}
NOTE: Using the hook is preferred. Only use the withEmbedded
HOC if you have a legacy Class component that cannot be migrated to a functional component.
import React, { useState } from 'react';
import { withEmbedded } from '@wedgekit/embedded';
const HOCDemo = (props) => {
return props.isEmbedded ? (
<h1>You are in the embedded browser!<h1>
) : (
<h1>You are NOT in the embedded browser!<h1>
);
};
export default withEmbedded(HOCDemo);
Node/CJS
const { useIsEmbedded, withEmbedded } = require('@wedgekit/embedded');