【问题标题】:What is the name of the design pattern used in method chaining in jQuery? [closed]jQuery 方法链中使用的设计模式的名称是什么? [关闭]
【发布时间】:2015-03-10 03:16:58
【问题描述】:

jQuery 中方法链背后的设计模式叫什么名字?

示例:$( "p" ).css( "color", "red" ).find( ".special" ).css( "color", "green" );

【问题讨论】:

  • 你到底在问什么?任何返回对象的方法调用都可以进行方法链接。仅此而已。
  • 我在问,该方法链接背后的设计模式的名称是什么。

标签: jquery design-patterns method-chaining


【解决方案1】:

根据这篇帖子https://softwareengineering.stackexchange.com/questions/137999/what-is-the-pattern-name-for-using-method-chaining-to-build-an-object,它被称为Fluent Interface

我看到许多文章将其简称为方法链接(这似乎更具描述性)以及链接模式。看起来你搜索得越多,你就能找到越多不同的名字,尽管有很多人提到了“流畅的界面”这个词。

【讨论】:

  • 谢谢............
猜你喜欢
  • 2015-07-25
  • 1970-01-01
  • 1970-01-01
  • 2015-03-08
  • 2020-01-25
  • 2015-08-05
  • 1970-01-01
  • 1970-01-01
  • 2017-12-22
相关资源
最近更新 更多