From 785d84d0ca47888d99115d5c95675ead93ffa2b4 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Fri, 17 Jan 2014 09:55:34 -0800 Subject: [PATCH] added count example --- examples/count.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 examples/count.js diff --git a/examples/count.js b/examples/count.js new file mode 100644 index 0000000000..917bec342d --- /dev/null +++ b/examples/count.js @@ -0,0 +1,26 @@ +// +// count.js +// hifi +// +// Created by Brad Hefta-Gaub on 12/31/13. +// Copyright (c) 2013 HighFidelity, Inc. All rights reserved. +// +// This is an example script that runs in a loop and displays a counter to the log +// + +var count = 0; + +function displayCount() { + print("count =" + count); + count++; +} + +function scriptEnding() { + print("SCRIPT ENDNG!!!\n"); +} + +// register the call back so it fires before each data send +Agent.willSendVisualDataCallback.connect(displayCount); + +// register our scriptEnding callback +Agent.scriptEnding.connect(scriptEnding);