From 84dead44c187e61648c9131de3aec927717484cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=A3=E5=90=92?= Date: Fri, 3 Dec 2021 17:15:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20add=20missing=20props=20f?= =?UTF-8?q?or=20lifecycles=20(#440)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/icestark-app/CHANGELOG.md | 4 ++++ packages/icestark-app/package.json | 2 +- packages/icestark-app/src/index.ts | 2 ++ packages/icestark-app/src/registerAppEnter.ts | 7 ++++++- packages/icestark-app/src/registerAppLeave.ts | 3 ++- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/icestark-app/CHANGELOG.md b/packages/icestark-app/CHANGELOG.md index 12ce1bbc..cf7f259f 100644 --- a/packages/icestark-app/CHANGELOG.md +++ b/packages/icestark-app/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.4.3 + +- [fix] add missing props for `registerAppEnter` & `registerAppLeave`. + ## 1.4.2 - [fix] Bind history to window when using `AppLink`. ([#428](https://github.com/ice-lab/icestark/pull/428)) diff --git a/packages/icestark-app/package.json b/packages/icestark-app/package.json index 3ce29234..7e103d0a 100644 --- a/packages/icestark-app/package.json +++ b/packages/icestark-app/package.json @@ -1,6 +1,6 @@ { "name": "@ice/stark-app", - "version": "1.4.2", + "version": "1.4.3", "description": "icestark-app is a JavaScript library for icestark, used by sub-application.", "scripts": { "build": "rm -rf lib && tsc", diff --git a/packages/icestark-app/src/index.ts b/packages/icestark-app/src/index.ts index 72042d47..0cf77553 100644 --- a/packages/icestark-app/src/index.ts +++ b/packages/icestark-app/src/index.ts @@ -8,3 +8,5 @@ export { default as appHistory } from './appHistory'; export { default as isInIcestark } from './isInIcestark'; export { default as AppLink } from './AppLink'; export { default as setLibraryName } from './setLibraryName'; + +export type { LifecycleProps } from './registerAppEnter'; diff --git a/packages/icestark-app/src/registerAppEnter.ts b/packages/icestark-app/src/registerAppEnter.ts index 44fded3b..c534c62f 100644 --- a/packages/icestark-app/src/registerAppEnter.ts +++ b/packages/icestark-app/src/registerAppEnter.ts @@ -1,6 +1,11 @@ import { setCache } from './cache'; -export default (callback?: () => void): void => { +export interface LifecycleProps { + container: HTMLElement | string; + customProps?: object; +} + +export default (callback?: (props: LifecycleProps) => void): void => { if (!callback) return; if (typeof callback !== 'function') { diff --git a/packages/icestark-app/src/registerAppLeave.ts b/packages/icestark-app/src/registerAppLeave.ts index 9c1794d0..0163e031 100644 --- a/packages/icestark-app/src/registerAppLeave.ts +++ b/packages/icestark-app/src/registerAppLeave.ts @@ -1,6 +1,7 @@ import { setCache } from './cache'; +import type { LifecycleProps } from './registerAppEnter'; -export default (callback?: () => void): void => { +export default (callback?: (props: LifecycleProps) => void): void => { if (!callback) return; if (typeof callback !== 'function') {