{"id":39288,"date":"2023-01-27T17:40:47","date_gmt":"2023-01-27T09:40:47","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=39288"},"modified":"2023-01-27T17:40:47","modified_gmt":"2023-01-27T09:40:47","slug":"java-arrow","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/java-arrow.html","title":{"rendered":"javaES6\u7bad\u5934\u51fd\u6570\u7684\u5168\u65b0\u7279\u6027"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u80d6\u7bad\u5934\u51fd\u6570\uff08Fat arrow functions\uff09\uff0c\u53c8\u79f0\u7bad\u5934\u51fd\u6570\uff0c\u662f\u4e00\u4e2a\u6765\u81eaECMAScript 2015\uff08\u53c8\u79f0ES6\uff09\u7684\u5168\u65b0\u7279\u6027\u3002\u6709\u4f20\u95fb\u8bf4\uff0c\u7bad\u5934\u51fd\u6570\u7684\u8bed\u6cd5\u201c=>\u201d\uff0c\u662f\u53d7\u5230\u4e86CoffeeScript \u7684\u5f71\u54cd\uff0c\u5e76\u4e14\u5b83\u4e0eCoffeeScript\u4e2d\u7684\u201c=>\u201d\u8bed\u6cd5\u4e00\u6837\uff0c\u5171\u4eabthis\u4e0a\u4e0b\u6587\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u65b0\u7684\u51fd\u6570\u8bed\u6cd5<\/strong><\/div>\n \u4f20\u7edf\u7684\u201cJavaScript\u201d\u51fd\u6570\u8bed\u6cd5\u5e76\u6ca1\u6709\u63d0\u4f9b\u4efb\u4f55\u7684\u7075\u6d3b\u6027\uff0c\u6bcf\u4e00\u6b21\u4f60\u9700\u8981\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u65f6\uff0c\u4f60\u90fd\u5fc5\u987b\u8f93\u5165\u201cfunction () {}\u201d\u3002\u201cCoffeeScript\u201d\u5982\u4eca\u4e4b\u6240\u4ee5\u90a3\u4e48\u706b\uff0c\u6709\u4e00\u4e2a\u4e0d\u53ef\u5ffd\u7565\u7684\u539f\u56e0\u5c31\u662f\u5b83\u6709\u66f4\u7b80\u6d01\u7684\u51fd\u6570\u8bed\u6cd5\u3002\u66f4\u7b80\u6d01\u7684\u51fd\u6570\u8bed\u6cd5\u5728\u6709\u5927\u91cf\u56de\u8c03\u51fd\u6570\u7684\u573a\u666f\u4e0b\u597d\u5904\u7279\u522b\u660e\u663e\uff0c\u8ba9\u6211\u4eec\u4ece\u4e00\u4e2a\u201cPromise\u201d\u94fe\u7684\u4f8b\u5b50\u770b\u8d77\uff1a<\/p>\n < class=\"js\">function<\/span> getVerifiedToken<\/span>(selector)<\/span> <\/span>{\r\n return<\/span> getUsers(selector)\r\n .then(function<\/span> (users)<\/span> <\/span>{ return<\/span> users[0<\/span>]; })\r\n .then(verifyUser)\r\n .then(function<\/span> (user, verifiedToken)<\/span> <\/span>{ return<\/span> verifiedToken; })\r\n .catch(function<\/span> (err)<\/span> <\/span>{ log(err.stack); });\r\n}<\/pre>\n |