{% include anchor.html title="Plugins" hash="plugins" %}
Writing a plugin is easy! The API is:
{% highlight js %}
PouchDB.plugin({
methodName: myFunction
});
{% endhighlight %}
This will add a `db.methodName()` to all databases, which runs `myFunction`.It will always be called in context, so that within the function, `this` refers to the database object.
There is a [PouchDB Plugin Seed project](https://github.com/pouchdb/plugin-seed), which is the fastest way to get started writing, building and testing your very own plugin.
#### Example Usage:
{% highlight js %}
PouchDB.plugin({
sayHello : function () {
console.log("Hello!");
}
});
new PouchDB('foobar').sayHello(); // prints "Hello!"
{% endhighlight %}