Skip to content

关于一段代码的疑问? #6

@xiaoyann

Description

@xiaoyann

先说声不好意思,在issue里提这样的问题
源码

var name = 'img_' + (+new Date());
        entry[name] = image;
        image.onload = image.onerror = function () {
            entry[name] =
                image =
                image.onload =
                image.onerror = null;
            delete entry[name];
        };

为什么要将 image 挂在entry对象上?然后是这个函数执行完后image不就销毁了吗?为什么还要通过监听onload和onerror来销毁?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions