Skip to content

Commit

Permalink
Expose clear cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrzej Skrodzki committed Dec 9, 2014
1 parent b133395 commit 771470f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "svg-typewriter",
"description": "A library for measuring, manipulating, and writing text on SVG.",
"version": "0.1.1",
"version": "0.1.2",
"main": ["svgtypewriter.js"],
"license": "MIT",
"ignore": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svgtypewriter",
"version": "0.1.1",
"version": "0.1.2",
"description": "A library for measuring, manipulating, and writing text on SVG.",
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions src/measurers/cacheCharacterMeasurer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ module SVGTypewriter.Measurers {
public _measureCharacter(c: string) {
return this.cache.get(c);
}

public reset() {
this.cache.clear();
}
}
}
1 change: 1 addition & 0 deletions svgtypewriter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,6 @@ declare module SVGTypewriter.Measurers {
constructor(area: D3.Selection, className?: string);
_measureCharacterNotFromCache(c: string): Dimensions;
_measureCharacter(c: string): Dimensions;
reset(): void;
}
}
7 changes: 5 additions & 2 deletions svgtypewriter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
SVG Typewriter 0.1.0 (https://github.com/palantir/svg-typewriter)
SVG Typewriter 0.1.2 (https://github.com/palantir/svg-typewriter)
Copyright 2014 Palantir Technologies
Licensed under MIT (https://github.com/palantir/svg-typewriter/blob/master/LICENSE)
Licensed under MIT (https://github.com/palantir/svg-typewriter/blob/develop/LICENSE)
*/

///<reference path="../reference.ts" />
Expand Down Expand Up @@ -945,6 +945,9 @@ var SVGTypewriter;
CacheCharacterMeasurer.prototype._measureCharacter = function (c) {
return this.cache.get(c);
};
CacheCharacterMeasurer.prototype.reset = function () {
this.cache.clear();
};
return CacheCharacterMeasurer;
})(Measurers.CharacterMeasurer);
Measurers.CacheCharacterMeasurer = CacheCharacterMeasurer;
Expand Down

0 comments on commit 771470f

Please sign in to comment.