-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 新增 extension API (for 飞流 and 行云)
- Loading branch information
yying
committed
Nov 7, 2019
1 parent
13a8027
commit 8403434
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { AppSDK } from '../sdk/AppSDK' | ||
import { APIBase, factory, IFactory } from './base' | ||
|
||
export interface ExtensionAPI { | ||
setReady(): Promise<void> | ||
openExtensionModal(): Promise<void> | ||
closeExtensionModal(): Promise<void> | ||
} | ||
|
||
class HostAPI extends APIBase { | ||
|
||
setReady(...params: any[]) { | ||
return this.call('setReady', ...params) | ||
} | ||
|
||
openExtensionModal(...params: any[]) { | ||
return this.call('openExtensionModal', ...params) | ||
} | ||
|
||
closeExtensionModal(...params: any[]) { | ||
return this.call('closeExtensionModal', ...params) | ||
} | ||
|
||
} | ||
|
||
export const hostAPI: IFactory<ExtensionAPI> = (sdk: AppSDK) => { | ||
return factory<HostAPI>(sdk, HostAPI) | ||
} |