Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Forrest Oliphant
committed
Feb 5, 2012
1 parent
268cb32
commit bcee907
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>delay</title> | ||
<meta name="author" content="forresto"> | ||
<meta name="description" content="holds some data then releases it" /> | ||
|
||
<script src="http://meemoo.org/meemoo/v1/meemoo-min.js"></script> | ||
|
||
<style type="text/css"> | ||
html, body { | ||
margin: 0; | ||
padding:0; | ||
font-family: verdana; | ||
font-size: 10px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div id="info"></div> | ||
|
||
<script type="text/javascript"> | ||
|
||
var stack = []; | ||
var delay = 1; | ||
document.getElementById("info").innerHTML = window.encodeURI( stack.length+"/"+delay ); | ||
|
||
function hold (data) { | ||
stack.push(data) | ||
while (stack.length > delay) { | ||
Meemoo.send("out",stack.shift()); | ||
} | ||
if (stack.length < delay) { | ||
document.getElementById("info").innerHTML = window.encodeURI( stack.length+"/"+delay ); | ||
} | ||
} | ||
|
||
function setDelay (_delay) { | ||
delay = _delay; | ||
if (stack.length > delay) { | ||
stack = stack.slice(0-delay, stack.length); | ||
} | ||
document.getElementById("info").innerHTML = window.encodeURI( stack.length+"/"+delay ); | ||
} | ||
|
||
Meemoo | ||
.setInfo({ | ||
title: "delay", | ||
author: "forresto", | ||
description: "holds some data then releases it" | ||
}) | ||
.addInputs({ | ||
in: { | ||
action: hold, | ||
type: "", | ||
description: "data to delay" | ||
}, | ||
delay: { | ||
action: setDelay, | ||
type: "int", | ||
min: 0, | ||
max: 5000, | ||
description: "number of items to hold", | ||
default: delay | ||
} | ||
}) | ||
.addOutputs({ | ||
out: { | ||
type: "" | ||
} | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters