public V8Script Compile(IncludeScript script, bool addToCache = true, int?cacheExpirationSeconds = null) { CachedV8Script cachedScript; script.EnsureScriptId(); if (TryGetCached(script.ScriptId, out cachedScript)) { return(cachedScript.Script); } if (string.IsNullOrEmpty(script.Code) && !string.IsNullOrEmpty(script.Uri)) { script.LoadScript(); } if (!string.IsNullOrEmpty(script.Code)) { if (!string.IsNullOrEmpty(script.PrependCode) || !string.IsNullOrEmpty(script.AppendCode)) { var builder = new StringBuilder(); builder.Append(script.PrependCode).Append(script.Code).Append(script.AppendCode); return(Compile(script.ScriptId, builder.ToString(), addToCache, cacheExpirationSeconds)); } return(Compile(script.ScriptId, script.Code, addToCache, cacheExpirationSeconds)); } return(null); }
public V8Script Compile(IncludeScript script, bool addToCache = true, int? cacheExpirationSeconds = null) { CachedV8Script cachedScript; script.EnsureScriptId(); if (TryGetCached(script.ScriptId, out cachedScript)) { return cachedScript.Script; } if (string.IsNullOrEmpty(script.Code) && !string.IsNullOrEmpty(script.Uri)) { script.LoadScript(); } if (!string.IsNullOrEmpty(script.Code)) { if (!string.IsNullOrEmpty(script.PrependCode) || !string.IsNullOrEmpty(script.AppendCode)) { var builder = new StringBuilder(); builder.Append(script.PrependCode).Append(script.Code).Append(script.AppendCode); return Compile(script.ScriptId, builder.ToString(), addToCache, cacheExpirationSeconds); } return Compile(script.ScriptId, script.Code, addToCache, cacheExpirationSeconds); } return null; }