Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

openfin/platform-api-project-seed

Repository files navigation

Platform API Project Seed

This project seed includes the following Platform API capabilites:

  • Examples of the configuration required to use the Platform API and apply customizations
  • Usage of the Platform API to group, tab, and rearrange application windows
  • API examples of View management and creation
  • API examples of Snapshot saving and applying
  • Examples of visual customization via CSS
  • Examples of visual customization by providing a custom Platform Window
  • Examples of behavioral customization by overriding the Platform APIs

Launch in OpenFin

Running the code

Basic Usage:

  • Clone this repository
  • Install the dependencies: npm install
  • Start the live-server and launch the application: npm start

Advanced Usage:

For users who would like to test features with a different OpenFin Runtime, configure your workspace as follows:

  • Generate a local manifest file, local.json, with the specified Runtime version, e.g. canary: npm start -- canary
  • Subsequent launches will automatically use local.json; delete this file to revert to app.json

Understanding the code

Platform configuration

CSS Customization

Platform Window

The platform-window.html file contains the layout-container element and two custom elements: left-menu and title-bar. These elements, in conjunction with the js/platform-window.js file, enable the following functionality:

left-menu

Provides examples of the following functionality:

  • Adding a View to an existing Window
  • Adding a View in a new Window
  • Saving the Window's current Layout
  • Restoring the Window's current Layout
  • Creating a regular OpenFin Window
  • Saving/Restoring Platform Snapshots
  • Applying a preset arrangement on the current window (Grid, Tabs, Rows)
title-bar

Provides examples of the following functionality:

  • Draggable area
  • Close/Maximize/Minimize buttons

Provider

Our custom Provider includes an extension that will look for a pre-configured list of externalWindows (the default being the provided my_platform_notes.txt file opened in notepad.exe) and:

  • Override getSnapshot to include a externalWindows section containing information on any any external window included in the configuration.
  • Override applySnapshot to look for an externalWindows section and restore the position and state of any external window included in the configuration.