w
clone your own copy | download snapshot

Snapshots | iceberg

No images in this repository’s iceberg at this time

Inside this repository

backbone.marionette.templatecache.min.js
application/javascript

Download raw (1.6 KB)

/**
* @license
* MarionetteJS (Marionette.TemplateCache)
* ----------------------------------
* v1.0.0
*
* Copyright (c)2018 Derick Bailey, Muted Solutions, LLC.
* Distributed under MIT license
*
* http://marionettejs.com
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("underscore"),require("backbone")):"function"==typeof define&&define.amd?define(["underscore","backbone"],t):(e.Marionette=e.Marionette||{},e.Marionette.TemplateCache=t(e._,e.Backbone))}(this,function(e,t){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t;var n=function(e){this.templateId=e};return e.extend(n,{templateCaches:{},render:function(t,r){if(!t)throw new Error("Cannot render the template since its false, null or undefined.");return(e.isFunction(t)?t:n.get(t))(r)},get:function(e,t){var r=this.templateCaches[e];return r||(r=new n(e),this.templateCaches[e]=r),r.load(t)},clear:function(){for(var e=void 0,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=n.length;if(a>0)for(e=0;e<a;e++)delete this.templateCaches[n[e]];else this.templateCaches={}}}),e.extend(n.prototype,{load:function(e){if(this.compiledTemplate)return this.compiledTemplate;var t=this.loadTemplate(this.templateId,e);return this.compiledTemplate=this.compileTemplate(t,e),this.compiledTemplate},loadTemplate:function(e,n){var r=t.$(e);if(!r.length)throw new Error('Could not find template: "'+e+'"');return r.html()},compileTemplate:function(t,n){return e.template(t,n)}}),n});
//# sourceMappingURL=marionette.templatecache.min.js.map