Monday, September 10, 2012

Chaining pattern

Method chaining is a common technique for invoking multiple method calls in object-oriented programming languages. Each method returns an object (possibly the current object itself), allowing the calls to be chained together in a single statement (Wikipedia definition). This technique was made popular in several libraries, like jQuery.

Let's see JQuery example of method chaining:

Here is how we can implement method chaining in JavaScript (Calculator example):

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete

  2. Thank you so much for providing good quality information. I think it would not have been easy to
    collect this information and organize it in an easy to understand way.
    I'll add it to my bookmarks so I can visit it often! And I will share it with my acquaintances.
    And there is a lot of useful information on our website too,
    so please take a look and take a look. Then have a good day

    Also visit my webpage - 오피사이트
    (jk)

    ReplyDelete