backbone icon indicating copy to clipboard operation
backbone copied to clipboard

destroy 方法逻辑错误

Open dongnan opened this issue 13 years ago • 3 comments

注释中写道:If wait: true is passed, waits for the server to respond before removal. 但是,设置了 options.wait = true,仍然会在服务器返回结果之前销毁 model。这个和注释不符。 问题代码: options.success = function(resp) { if (options.wait || model.isNew()) destroy(); if (success) success(model, resp, options); if (!model.isNew()) model.trigger('sync', model, resp, options); };

dongnan avatar Oct 25 '13 06:10 dongnan

In English pls. Most people here are not Chinese speaker...

ivanzhaowy avatar Oct 25 '13 07:10 ivanzhaowy

哥们,是你理解的有问题,把问题关了吧

Yahasana avatar Oct 25 '13 08:10 Yahasana

Notes wrote: If wait: true is passed, waits for the server to respond before removal. However, setting up options.wait = true, the server returns the results will still be destroyed before model. This and the comments do not match. Code in question:

from Google translate… anyway, it seems correct to me why do you think it should do otherwise? wait: true option means it should wait for the server response before Backbone will take action right? From your snippet that exactly what it does it is calling the destroy() function from within success callback if you have wait: true

j03w avatar Oct 25 '13 11:10 j03w