Retrieve -- 返回、得到

BrE /rɪ'triːv/ ; AmE /rɪ'triːv/

  1. vt. 寻回, 找回
  2. 恢复, 挽回
  3. 检索(储存的信息)
  4. 使某事物恢复旺盛状态
  5. vt. & vi. (指经过训练的狗)找到并衔回(被打死或打伤的鸟等)

# 栗子

  1. Vue
Vue.component('async-webpack-example', function (resolve) {
  // This special require syntax will instruct Webpack to
  // automatically split your built code into bundles which
  // are loaded over Ajax requests.
  require(['./my-async-component'], resolve)
})
1
2
3
4
5
6

As you can see, the factory function receives a resolve callback, which should be called when you have retrieved your component definition from the server. 如你所见,这个工厂函数会收到一个 resolve 回调,这个回调函数会在你从服务器得到组件定义的时候被调用。

  1. React
const CommentListWithSubscription = withSubscription(
  CommentList,
  (DataSource) => DataSource.getComments()
);

const BlogPostWithSubscription = withSubscription(
  BlogPost,
  (DataSource, props) => DataSource.getBlogPost(props.id)
);
1
2
3
4
5
6
7
8
9

The first parameter is the wrapped component. The second parameter retrieves the data we’re interested in, given a DataSource and the current props. 第一个参数是被包装组件。第二个参数通过 DataSource 和当前的 props 返回我们需要的数据。

# 最后

是不是发现当你想表达返回的时候会想起 return 这个单词,当然 return 更多的是指你调用的函数的返回动作,当你想表达你想得到一个返回的时候,就需要用 retrieve 了。它有一个 re 前缀,就和 get 这类单词区分开了。它能更清晰地表达,你想得到的是一个你曾经发起的,并预期有一个反馈的东西。

关注公众号【程序员英语词汇】获取最新内容
程序员英语词汇
Copyright © 2020 Ted Yuen