aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/SkV8Example/sample.js
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-18 04:45:37 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-18 04:45:37 +0000
commit0fc0dea333f313a579558beb7ba498db0711780e (patch)
tree02bbfa9462cbe17476c7f06e594a9db8a8c8652c /experimental/SkV8Example/sample.js
parent4e8f1e56b17c3663d1892f44a4c1893b568ce67f (diff)
Add a setTimer() function.
Seemed simple, but required adding a Global class that contains all the global state (instance and context) for our running V8 instance. Also moved canvas.inval to be just inval() at the global level. BUG= R=robertphillips@google.com Author: jcgregorio@google.com Review URL: https://codereview.chromium.org/103143009 git-svn-id: http://skia.googlecode.com/svn/trunk@12730 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/SkV8Example/sample.js')
-rw-r--r--experimental/SkV8Example/sample.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/experimental/SkV8Example/sample.js b/experimental/SkV8Example/sample.js
index 3a95e55106..b516062044 100644
--- a/experimental/SkV8Example/sample.js
+++ b/experimental/SkV8Example/sample.js
@@ -4,10 +4,17 @@
var onDraw = function(){
var tick = 0;
function f(canvas) {
- tick += 0.01;
+ tick += 0.1;
canvas.fillStyle = '#0000ff';
canvas.fillRect(100, 100, Math.sin(tick)*100, Math.cos(tick)*100);
- canvas.inval();
};
return f;
}();
+
+function onTimeout() {
+ inval();
+ print("Got a timeout!");
+ setTimeout(onTimeout, 33);
+}
+
+setTimeout(onTimeout, 33);