Skip to content

Event listeners not properly cleaned up #14

@nirdil

Description

@nirdil

When you create the new image in the preLoader service you attach the 'load' and 'error' event handlers. As far as I know (and tested), these listeners need to be cleaned up otherwise you'll be left with a leak.
Something like this worked for me:

var preloaderImage = angular.element(new Image());
preloaderImage.on('load', function () {
      preloaderImage.off();
      successCallback();
}).on('error', function () {
      preloaderImage.off();
      errorCallback();
}).attr('src', url);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions