Class: CloudFunction

Implements

  • Plugin

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new CloudFunction(config?)

创建云函数配置

Parameters

NameTypeDescription
config?CloudFunctionConfig配置项,这些配置将强制覆盖默认配置

Properties

config

config: Object

Index signature

▪ [key: string]: any

Type declaration

NameType
memorySize?number
name?string
timeout?number
triggers?{ name: string ; type: string ; value: string }[]

context

context: any


event

event: any


name

Readonly name: string = Name

Implementation of

Plugin.name


type

Readonly type: string = Name

Implementation of

Plugin.type

Methods

invoke

invoke<TData>(name, data?, options?): Promise<void>

异步触发云函数

Type parameters

NameType
TDataany

Parameters

NameTypeDescription
namestring云函数文件名或云函数名
data?TData参数
options?Object额外配置项

Returns

Promise<void>


invokeSync

invokeSync<TResult, TData>(name, data?, options?): Promise<TResult>

同步调用云函数

Type parameters

NameType
TResultany
TDataany

Parameters

NameTypeDescription
namestring云函数文件名或云函数名
data?TData参数
options?Object额外配置项

Returns

Promise<TResult>


onDeploy

onDeploy(data, next): Promise<void>

Parameters

NameType
dataDeployData
nextNext

Returns

Promise<void>

Implementation of

Plugin.onDeploy


onInvoke

onInvoke(data, next): Promise<void>

Parameters

NameType
dataInvokeData<any, any, any>
nextNext

Returns

Promise<void>

Implementation of

Plugin.onInvoke


onMount

onMount(data, next): Promise<void>

Parameters

NameType
dataMountData
nextNext

Returns

Promise<void>

Implementation of

Plugin.onMount