UNPKG

kitten-cloud-function

Version:

用于编程猫源码云功能(云变量、云列表等)的客户端工具

31 lines (30 loc) 1.19 kB
import { KittenCloudVariable } from "./kitten-cloud-variable"; import { KittenCloudDataUpdateSource } from "./update/kitten-cloud-data-update-source"; import { KittenCloudPublicVariableSetCommand } from "./update/command/kitten-cloud-public-variable-set-command"; /** * 公有云变量。 */ export class KittenCloudPublicVariable extends KittenCloudVariable { constructor(connection, group, cvid, name, value) { super(connection, group, cvid, name, value); this.group = group; } update(value) { value = this.singleValueProcess(value); this.updateManager.addUpdateCommand(new KittenCloudPublicVariableSetCommand(KittenCloudDataUpdateSource.CLOUD, this, value)); } /** * 设置公有云变量的值。 * * @param value 要设置的值 */ set(value) { value = this.singleValueProcess(value); const command = new KittenCloudPublicVariableSetCommand(KittenCloudDataUpdateSource.LOCAL, this, value); this.updateManager.addUpdateCommand(command); command.promise.catch((error) => { this.connection.errored.emit(error); }); return command.promise; } }