Skip to content

Does console.log work within greenlet? #6

Description

@tommy-mitchell

I'm not sure if this is a limitation of this library or of Workers in general, but I was expecting the following code to log each index:

import { greenlet } from "tinylet";

const func = greenlet(() => {
	let count = 0;

	for (let i = 0; i < 1000; i++) {
		count = i + 1;
		console.log(`Item: ${i}`);
	}

	return count;
});

const count = await func();
console.log({ count });

However, the actual output is:

Item: 0
{ count: 1000 }

Why does it only log inside of the worker once?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions