Update README

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen committed 2023-03-02 15:12:54 +02:00
1 parent 86fe5e6d14
commit 046d72b99f
2 files changed
+60 -7

No files matched your search

@@ -2,17 +2,38 @@
This package contains stuff related to creating Lens-applications. This package contains stuff related to creating Lens-applications.
In the beginning it will contain just the injection tokens used to configure the application. # Usage
## Install
```bash ```bash
$ npm install @k8slens/application $ npm install @k8slens/application-for-electron-main
```
```typescript
import { applicationFeature, startApplicationInjectionToken } from "@k8slens/application";
import { registerFeature } from "@k8slens/feature-core";
import { createContainer } from "@ogre-tools/injectable";
const di = createContainer("some-container");
registerFeature(di, applicationFeature);
const startApplication = di.inject(startApplicationInjectionToken);
startApplication();
``` ```
## Usage ## Features
As of now, this package doesn't do anything alone. It just provides you way to register implementation for contract. #### Start application
`startApplicationInjectionToken`
Future ambition is that all stuff related to how applications are built will be relocated here. Starts the application and calls timeslots in specified order. Check for timeslots for more info.
## Extendability
#### Timeslots
1. `beforeApplicationIsLoadingInjectionToken`
2. `onLoadOfApplicationInjectionToken`
3. `afterApplicationIsLoadedInjectionToken`
@@ -1,3 +1,35 @@
# @k8slens/application-for-electron-main # @k8slens/application-for-electron-main
TBD This Feature extends `@k8slens/application` with Electron specifics.
# Usage
```bash
$ npm install @k8slens/application-for-electron-main
```
```typescript
import { applicationFeature, startApplicationInjectionToken } from "@k8slens/application";
import { applicationFeatureForElectronMain } from "@k8slens/application-for-electron-main";
import { registerFeature } from "@k8slens/feature-core";
import { createContainer } from "@ogre-tools/injectable";
const di = createContainer("some-container");
registerFeature(di, applicationFeature, applicationFeatureForElectronMain);
const startApplication = di.inject(startApplicationInjectionToken);
startApplication();
```
# Extendability
### Timeslots
#### `beforeAnythingInjectionToken`
Runnables registered here will be called before anything else. **Special requirement** here is that everything here needs to be synchronous.
#### `beforeElectronIsReadyInjectionToken`
Runnables registered here will be called right after runnables in `beforeAnythingInjectionToken` but still before we are sure that Electron application is ready (`electron.app.whenReady()`). **Special requirement** here is that everything here needs to be synchronous.