mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
784 B
46 lines
784 B
12 years ago
|
/*---
|
||
|
{
|
||
|
"custom": true
|
||
|
}
|
||
|
---*/
|
||
12 years ago
|
|
||
|
/*===
|
||
|
resume tests
|
||
|
yielder starting
|
||
|
yielder arg: foo
|
||
|
yielded with 1
|
||
|
resumed with bar
|
||
|
yielded with 2
|
||
|
resumed with quux
|
||
|
yielded with 3
|
||
|
resumed with baz
|
||
|
yielder ending
|
||
|
yielded with 123
|
||
|
finished
|
||
|
===*/
|
||
|
|
||
|
function yielder(x) {
|
||
|
var yield = __duk__.yield;
|
||
|
|
||
|
print('yielder starting');
|
||
|
print('yielder arg:', x);
|
||
|
|
||
|
print('resumed with', yield(1));
|
||
|
print('resumed with', yield(2));
|
||
|
print('resumed with', yield(3));
|
||
|
|
||
|
print('yielder ending');
|
||
|
return 123;
|
||
|
}
|
||
|
|
||
|
var t = __duk__.spawn(yielder);
|
||
|
|
||
|
print('resume tests');
|
||
|
print('yielded with', __duk__.resume(t, 'foo'));
|
||
|
print('yielded with', __duk__.resume(t, 'bar'));
|
||
|
print('yielded with', __duk__.resume(t, 'quux'));
|
||
|
print('yielded with', __duk__.resume(t, 'baz'));
|
||
|
|
||
|
print('finished');
|
||
|
|