Skip to content

Commit

Permalink
- Added function to clear the internal expressions cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
amarcruz committed Jul 19, 2016
1 parent 6d64e3d commit 995fd99
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
# riot-tmpl Changes

### v2.4.1
- Added function to clear the internal expressions cache.

### v2.4.0
- It closes [riot#1076](https://github.com/riot/riot/issues/1076) using a fork of [notevil](https://github.com/mmckegg/notevil)

Expand Down
19 changes: 11 additions & 8 deletions src/tmpl.js
Expand Up @@ -89,6 +89,14 @@ var tmpl = (function () {
*/
_tmpl.loopKeys = brackets.loopKeys

/**
* Clears the internal cache of compiled expressions.
*
* @function
*/
// istanbul ignore next
_tmpl.clearCache = function () { _cache = {} }

/**
* Holds a custom function to handle evaluation errors.
*
Expand Down Expand Up @@ -145,15 +153,13 @@ var tmpl = (function () {
//#elif LIST_GETTERS
//console.log(' In: `%s`\nOUT: `%s`', str, expr)
//#endif
/* eslint-disable */
//#if CSP
/*#if CSP
return safeEval.func('E', expr + ';')
//#else
#else*/
// Now, we can create the function to return by calling the Function constructor.
// The parameter `E` is the error handler for runtime only.
return new Function('E', expr + ';')
return new Function('E', expr + ';') // eslint-disable-line no-new-func
//#endif
/* eslint-enable */
}

//
Expand Down Expand Up @@ -391,9 +397,6 @@ var tmpl = (function () {
return expr
}

// istanbul ignore next: compatibility fix for beta versions
_tmpl.parse = function (s) { return s }

//#if !NODE
_tmpl.version = brackets.version = 'WIP'
//#endif
Expand Down

0 comments on commit 995fd99

Please sign in to comment.