amplify.subscribe("WorkTypesReceived", function () {
var workTypesList = amplify.store("ExpenseWorkTypesFor" + JobNo_);
amplify.unsubscribe("WorkTypesReceived");
});
getDropdownExpenseWorkTypes(JobNo_);
我getDropdownExpenseWorkTypes
调用了一个在完成时发布的函数"WorkTypesReceived"
。但由于我在一个页面上不止一次调用整个函数,它呈指数级增长(同一主题的多个订阅)。我想在订阅发布一次后删除订阅(因此进入订阅功能一次)。
该行amplify.unsubscribe("WorkTypesReceived")
似乎不起作用,文档说我需要第二个参数作为回调函数。但我在回调函数内部,所以不确定如何继续。