kitten-cloud-function
Version:
用于编程猫源码云功能(云变量、云列表等)的客户端工具
29 lines (28 loc) • 1 kB
JavaScript
import { KittenCloudFunctionConfigLayer } from "../kitten-cloud-function-config-layer";
import { KittenCloudDataUpdateManager } from "./update/kitten-cloud-data-update-manager";
/**
* 云数据。
*/
export class KittenCloudData extends KittenCloudFunctionConfigLayer {
constructor(connection, group, cvid, name) {
super(group);
this.connection = connection;
this.group = group;
this.cvid = cvid;
this.name = name;
this.updateManager = new KittenCloudDataUpdateManager(connection, this);
}
singleValueProcess(value) {
if (typeof value == "number") {
return value;
}
if (typeof value != "string") {
throw new Error(`不支持的值类型:${typeof value}`);
}
let stringValue = value;
if (stringValue.length > this.stringLengthLimit.value) {
stringValue = stringValue.slice(0, this.stringLengthLimit.value);
}
return stringValue;
}
}