diff --git a/README.md b/README.md index 2a86f03..c4f7069 100644 --- a/README.md +++ b/README.md @@ -129,3 +129,6 @@ The `getRanges` function is the second function that every Speed Provider must o This line registers the Speed Provider class that was just created with Drag Ruler. The paramter must be the id of the module you're writing. This id must exactly match the id specified in you manifest. As the second parameter the Speed Provider class that was just created is passed in. If you're not writing a module but a game system use `dragRuler.registerSystem` instead of `dragRuler.registerModule. + +### Additional capabilities of the API +In addition to the basic capabilities of the API presented in the example above, Drag Ruler's API offers more capabilities, like adding settings to your Speed Provider. To learn more about additional capabilities refer to the documentation of the `SpeedProvider` base class in [speed_provider.js](src/speed_provider.js). diff --git a/src/speed_provider.js b/src/speed_provider.js index 9843542..48d9377 100644 --- a/src/speed_provider.js +++ b/src/speed_provider.js @@ -56,6 +56,18 @@ export class SpeedProvider { return 0xFF0000 } + /** + * Returns a boolean indicating whether this token will use a Ruler or not. + * If this is returns `false` for a token Drag Ruler will be disabled for that token. Dragging a token for which this function + * returns false will behave as if Drag Ruler wasn't installed. + * If usesRuler returns `false` it's guranteed that the `getRanges` function won't be called for that token. + * + * Implementing this method is optional and only needs to be done if you want to disable Drag Ruler for some tokens. + */ + usesRuler(token) { + return true + } + /** * Returns the value that is currently set for the setting registered with the provided settingId. * @@ -73,16 +85,6 @@ export class SpeedProvider { } } - /** - * Returns a boolean indicating whether this token will use a Ruler or not. - * If this is returns `false` for a token Drag Ruler will be disabled for that token. Dragging a token for which this function - * returns false will behave as if Drag Ruler wasn't installed. - * If usesRuler returns `false` it's guranteed that the `getRanges` function won't be called for that token. - */ - usesRuler(token) { - return true - } - /** * Constructs a new instance of he speed provider *