Skip to content

Consider removing expose(), call() and kill() ? #26

Open

Description

@ribizli
	worker.expose = methodName => {
		worker[i] = function() {
			return worker.call(methodName, [].slice.call(arguments));
		};
	};

Instead methodName parameter should be used:

	worker.expose = methodName => {
		worker[methodName] = function() {
			return worker.call(methodName, [].slice.call(arguments));
		};
	};

Beside that I don't see why the call and expose methods are accessible from outside. (Don't assign to worker at all)
The purpose of the kill method is also not clear for me.

Activity

  1. added a commit that references this issue on Apr 5, 2018
  2. developit commented on Apr 5, 2018

    @developit
    Owner

    heh - i was a mistake, but it still worked for automatic methods because it was using i from the outer scope.

    call and expose are both exposed because sometimes autogeneration could fail. It might be worth looking into the byte cost for this, though - I'm not sure they are widely used. Kill is just a way to shut down the worker before terminating it, and probably worth applying the same scrutiny as the other two.

  3. changed the title [-]expose uses closure variable i[/-] [+]Consider removing expose(), call() and kill() ?[/+] on Apr 5, 2018
  4. vano21 commented on Apr 14, 2018

    @vano21

    Is it possible to terminate a worker from the main app and if so how? Calling terminate() or kill() doesn't work. Thanks.

  5. developit commented on May 11, 2018

    @developit
    Owner

    terminate() should work.

  6. boblauer commented on May 11, 2018

    @boblauer
    Contributor

    A fix for terminate() not working - #28

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

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions