@openfin/core
TypeScript icon, indicating that this package has built-in type declarations

35.79.5 • Public • Published

ℹ️ Note: @openfin/core is changing the structure of its output. See v33 Bundling Changes

OpenFin Core

This package contains the type definitions and API entry points for the OpenFin Core API. Start here to develop OpenFin applications in TypeScript.

Libraries are also available for the following frameworks:

Installation

This package cannot be installed as a dev dependency because it is not types-only.

With npm:

$ npm i -S @openfin/core

With yarn:

$ yarn add @openfin/core

Usage

The fin export is the primary API entry point. Type definitions are defined in the package's default export.

The static fin.me object contains some information about the current runtime environment even if imported outside of an OpenFin setting. In this case, the isOpenFin property of fin.me will be false. Outside of OpenFin environments, OpenFin API calls will nullop and throw an error.

import OpenFin, { fin } from "@openfin/core"; 

const showWindow = async (identity: OpenFin.Identity) => {
   const win = await fin.Window.wrap(identity);
   await win.show();

   const isOpenFin = fin.me.isOpenFin; // false if not in OpenFin
}

Importing the type

To import the OpenFin namespace:

import OpenFin from "@openfin/core"; 

type OFWindow = OpenFin.Window;

TSConfig types array

To have the OpenFin available in your code automatically, just update your tsconfig types key:

{
  "compilerOptions": {
    "target": ...,
    "module": ...,
    ...,
    "types": ["@openfin/core/OpenFin"]
  }
}

For more information

Migrations

v33 Bundling Changes

@openfin/core is moving to a single entry file format. This means that there will be a stricter set of entry points included in the package. This differs from the previous unbundled format, in which output files were broken into many common JS modules.

These changes will allow for improved API and type discoverability via code suggestion and type inspection, and create a clearer, more dependable usage contract for consumers of the package.

Explicit imports from arbitrary files within the module directory (e.g. "@openfin/core/*") will no longer be supported in new versions of @openfin/core , for example:

import { fin } from '@openfin/core/src/mock';

Should be replaced with:

import { fin } from '@openfin/core';

Until further notice, older versions of the @openfin/core package will be compatible with newer versions of the runtime. However, new types and features will only be available in newer releases of @openfin/core

v30 Ambient type changes

Prior to v30, the OpenFin namespace was ambiently declared and always available. Starting with v30, you must import it directly or specify it in the tsconfig.

License

Copyright 2020-2023 OpenFin

The code in this package is distributed under the Apache License, Version 2.0.

However, if you run this code, it may call on the OpenFin RVM or OpenFin Runtime, which are covered by OpenFin's Developer, Community, and Enterprise licenses. You can learn more about OpenFin licensing at the links listed below or email us at support@openfin.co with questions.

Readme

Keywords

none

Package Sidebar

Install

npm i @openfin/core

Weekly Downloads

1,563

Version

35.79.5

License

SEE LICENSE IN LICENSE.md

Unpacked Size

3.21 MB

Total Files

11

Last publish

Collaborators

  • yoge-openfin
  • nil.ffej
  • gilesstevenson-openfin
  • eheyder
  • newaz.sharif
  • efraim-herstic
  • royhafin
  • openfincolinhu
  • openfin-johans
  • alan15008
  • openfin-ci-gh
  • hina-khalid
  • ife-dev1
  • mjosling
  • elliott.burr
  • vsaw3
  • aykochubey
  • gallak-openfin
  • galim.kaudinov
  • dewinner
  • hzhi0209
  • andy.westacott
  • __tomasz__
  • cameronopenfin
  • jennrondeau
  • dhilan
  • benstubbington
  • davidcoxon-of
  • openfin-jeff
  • gouthamc
  • hannahmcmillen
  • xyopenfin
  • smocarski
  • eugeneross-openfin
  • imansuri
  • manamiueda
  • sakibahmad
  • shahossain
  • openfinbrandon
  • pierrebaize
  • noyangunday
  • michaelmcoates
  • johnmandia-openfin
  • rdepena
  • tgoc99
  • wenjunche
  • harsimran.openfin.singh
  • luiemilio
  • licui3936
  • connormccafferty
  • adam.saland
  • openfin-ci
  • chrishobsonexpero
  • richbrowne-openfin
  • azizyok
  • openfin-gavin
  • oblarg