Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jiju-MS/e74da1b22153d4abcd80b65e8f4e0959 to your computer and use it in GitHub Desktop.
Save jiju-MS/e74da1b22153d4abcd80b65e8f4e0959 to your computer and use it in GitHub Desktop.
function increment(amount: number, interval: any, invocation: CustomFunctions.StreamingInvocation<any[][]>): void {
var Entity1 = {
type: "Entity",
basicType: "Error",
basicValue: "#VALUE!",
text: "Entity 1",
properties: {
TestDouble: { type: "Double", basicType: "Double", basicValue: 1 },
TestString: { type: "String", basicType: "String", basicValue: "Test" }
}
};
var Entity2 = {
type: "Entity",
basicType: "Error",
basicValue: "#VALUE!",
text: "Entity 2",
properties: {
TestDouble: { type: "Double", basicType: "Double", basicValue: 2 },
TestString: { type: "String", basicType: "String", basicValue: "Test" }
}
};
let result = [[Entity1], [Entity2]];
const timer = setInterval(() => {
Entity1.properties.TestDouble.basicValue += amount;
Entity2.properties.TestDouble.basicValue += amount
invocation.setResult(result);
}, interval);
invocation.onCanceled = () => {
clearInterval(timer);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment