Skip to content

Instantly share code, notes, and snippets.

View cowsrule's full-sized avatar
🌧️
Seattle

Grant Watters cowsrule

🌧️
Seattle
  • Convoy
  • Seattle, WA
View GitHub Profile
@cowsrule
cowsrule / KOTemplateCache.js
Last active December 17, 2015 16:59
A simple plugin for knockout.js that caches DOM nodes created for named templates. Knockout JS Template Cache
define(['ko'],
function (ko) {
var self = { };
var cachedTemplatesDomDataKey = "__cached_template__";
//
// When rendering a template, a source is what returns either the text or the already-created DOM
// nodes to clone. The default implementation of a template source in knockout doesn't cache the
// DOM nodes that it creates, and instead requests the text of the <script> tag the template is