During an automation project, generally you work on same web application. And during this project you see that making a procedure is same on all of the test cases (like ensuring the synchronization of a web page). You can make use of shared function library to develop faster/easier/maintainable test scripts (Also you can check Extensibility plugin).
Adding custom methods to an object may be one of these. For example during the synchronization of the web page we want to make sure that the Browser object is activated. To accomplish this I've added a method named "Activate" to the "Browser" object.
The first thing to do is write a generic method that activates the browser:
Second (just after the function declaration) we are registering this method to the Browser object.
Now you can use the Activate method of the Browser object.