jnordberg / gif.js

JavaScript GIF encoding library

Home Page:http://jnordberg.github.io/gif.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

workers are not terminated

devjiro76 opened this issue · comments

Even official demo page 'https://jnordberg.github.io/gif.js/'
Workers are not terminated after generate GIF.

image

How can I terminate Workers?

Also running into this, workers are piling up. .abort() only works for active workers, and reusing the gif instance causes an error when .render() gets called again.

Workaround: The workers can be accessed through GIF.freeWorkers. To clean up, call:

gif.freeWorkers.forEach(w => w.terminate());
commented

Workaround: The workers can be accessed through GIF.freeWorkers. To clean up, call:

gif.freeWorkers.forEach(w => w.terminate());

thanks, save my life

You actually have to call
gif.abort();
at it clears a status variable too.