Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] removes prototype examples and uses classes instead #209

Merged
merged 2 commits into from
Jan 13, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,18 @@ It is configured by subclassing and refining `cacheKey` method. A good key here,
likely the name of the plugin, its version and the actual versions of its dependencies.

```js
Subclass.prototype.cacheKey = function() {
return md5(Filter.prototype.call(this) + inputOptionsChecksum + dependencyVersionChecksum);
const Filter = require('broccoli-persistent-filter');

class Subclass extends Filter {
constructor(inputNode, search, replace, options = {}) {
super(inputNode, {
annotation: options.annotation
});
}

rwjblue marked this conversation as resolved.
Show resolved Hide resolved
cacheKey() {
return md5(Filter.prototype.call(this) + inputOptionsChecksum + dependencyVersionChecksum);
}
}
```

Expand All @@ -162,8 +172,18 @@ for rebuilds. See the `dependencyInvalidation` option above to invalidate
files that have dependencies that affect the output.

```js
Subclass.prototype.cacheKeyProcessString = function(string, relativePath) {
return superAwesomeDigest(string);
const Filter = require('broccoli-persistent-filter');

class Subclass extends Filter {
constructor(inputNode, search, replace, options = {}) {
super(inputNode, {
annotation: options.annotation
});
}

rwjblue marked this conversation as resolved.
Show resolved Hide resolved
cacheKeyProcessString(string, relativePath) {
return superAwesomeDigest(string);
}
}
```

Expand Down