Updated Making OpenSeadragon Plugins (markdown)

iangilman 2013-09-04 10:20:39 -07:00
parent 71537ec4c4
commit 41f447a0dd

@ -8,12 +8,13 @@ Tips:
* If you want to add methods to any of OpenSeadragon's classes, add it to the class's prototype, such as `OpenSeadragon.Viewer.prototype.myFunc = function() { ... }`.
* Minimize your plugin's footprint: instead of adding a bunch of new methods, just add a single multi-purpose method. That way you're less likely to collide with other plugins, and it'll be easier for developers to keep track of what belongs to your plugin.
* Use an "options" object in your method to keep things flexible.
* Perhaps we should have a convention that the plugin file be prefixed with `openseadragon-`, like `openseadragon-scalebar.js`.
Example:
```
(function($) {
OpenSeadragon.myPlugin = function(options) {
$.myPlugin = function(options) {
options = options || {};
if (options.foo) {
...