3.1.0 • Published 1 year ago

@wedgekit/embedded v3.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

@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');
3.1.0

1 year ago

3.0.1-tc.0

1 year ago

3.0.0

2 years ago

2.0.1

2 years ago

2.0.0

3 years ago

1.0.0

3 years ago

1.0.0-tc.0

3 years ago