// Method called when the team level plugin is being installed.
export async function Install(request: PluginRequest) {
Logger.info('[Plugin] Install')
}
// Method called when the team level plugin is being launched.
export async function Enable(request: PluginRequest) {
Logger.info('[Plugin] Enable')
}
// Method called when the team level plugin is being suspended.
export function Disable(request: PluginRequest) {
Logger.info('[Plugin] Disable')
}
// Method called when the team level plugin is being uninstalled.
export function UnInstall(request: PluginRequest) {
Logger.info('[Plugin] UnInstall')
}
// Method called when the team level plugin is being upgraded.
export function Upgrade(oldPluginInfo: any, request: PluginRequest) {
const oldVersion = oldPluginInfo.version
Logger.info('[Plugin] Upgrade', 'old version:', oldVersion)
}
// Method called when the organization level plugin is being installed.
export async function OrgInstall(
request: PluginRequest,
teamUUIDList: string[],
firstInstall: boolean,
) {
Logger.info('[Plugin] OrgInstall')
}
// Method called when the organization level plugin is being launched.
export function OrgEnable(
request: PluginRequest,
teamUUIDList: string[],
): void | string[] | Promise<string[]> {
Logger.info('[Plugin] OrgEnable')
return []
}
// Method called when the organization level plugin is being suspended.
export function OrgDisable(
request: PluginRequest,
teamUUIDList: string[],
): void | string[] | Promise<string[]> {
Logger.info('[Plugin] OrgDisable')
return []
}
// Method called when the organization level plugin is being uninstalled.
export function OrgUnInstall(request: PluginRequest, teamUUIDList: string[]) {
Logger.info('[Plugin] OrgUnInstall')
}
// Method called when the organization level plugin is being upgraded.
export function OrgUpgrade(oldPluginInfo: any, request: PluginRequest, teamUUIDList: string[]) {
Logger.info('[Plugin] OrgUpgrade')
}
使用生命周期方法
生命周期方法声明在插件工程的/backend/src/index.ts文件中,每个插件工程在初始化时,会预先生成生命周期函数的模版。
文档地址:https://developer.ones.cn/zh-CN/docs/guide/advanced/lifecycle