簡體   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