2011-03-25 16:42:09 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
2012-03-24 11:34:42 +00:00
|
|
|
<meta charset="utf-8">
|
2017-08-24 13:25:25 +00:00
|
|
|
<title>Web Console test for bug 632347 - generators</title>
|
2011-03-25 16:42:09 +00:00
|
|
|
<!-- Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
2017-11-29 08:01:04 +00:00
|
|
|
<script type="application/javascript">
|
2011-03-25 16:42:09 +00:00
|
|
|
(function(){
|
2017-11-01 14:01:08 +00:00
|
|
|
function* genFunc() {
|
2011-03-25 16:42:09 +00:00
|
|
|
var a = 5;
|
|
|
|
while (a < 10) {
|
|
|
|
yield a++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-26 21:39:46 +00:00
|
|
|
window._container = {};
|
|
|
|
|
|
|
|
_container.gen1 = genFunc();
|
|
|
|
_container.gen1.next();
|
2011-03-25 16:42:09 +00:00
|
|
|
|
2017-08-24 13:25:25 +00:00
|
|
|
_container.gen2 = (function* () { for (let i = 3; i <= 15; ++i) yield i * 2; })();
|
2011-03-25 16:42:09 +00:00
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2017-08-24 13:25:25 +00:00
|
|
|
<p>Web Console test for bug 632347 - generators.</p>
|
2011-03-25 16:42:09 +00:00
|
|
|
</body>
|
|
|
|
</html>
|