繁体   English   中英

如何在浏览器中告诉我s3操作已完成并且存储桶的状态是一致的?

[英]How can I tell, in the browser, that my s3 operation has completed and the state of my bucket is consistent?

使用打字稿中的AWS开发工具包(请原谅,它仍在开发中):

在我的Angular2服务中:

return this.bucket.deleteObject(params).promise();

在我的组件中:

this.uploadService.delete(key).then(/*returns before bucket is consistent, listing its contents still shows the deleted item for a few seconds);

如何使UI与S3存储桶的状态保持一致? 之后是否需要轮询几秒钟并显示某种进度指示器?

嘿,快速浏览了您如何实现承诺。 我认为您在服务中不需要.promise()。 你有没有这样尝试过:

export class TestComponent
{
    private key = 'something';

    constructor(private uploadService: UploadService)
    {
    }

    ngOnInit()
    {
        this.uploadService
            .delete(this.key)
            .then((err, data) =>
            {
                if (err)
                {
                    console.log(err, err.stack);
                }
                else
                {
                    console.log(data);
                }
            })
    }
}

export class UploadService
{
    delete(params)
    {
        return this.bucket.deleteObject(params);
    }

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM