예제 #1
0
		/// <summary>
		/// Add a script with optional dependencies to the load sequence.
		/// </summary>
		/// <param name="code">The JS. No script tags. The code will run inside of a (function(){...}()) meaning any variables are isolated from
		/// other scripts on the page</param>
		/// <param name="dependencies">Optional. Scripts this code depends on. Pass null if none.</param>
		public void RunJsAfter(string code, string dependencies)
		{
			// Generate a name for this code chunk, to prevent collisions, and play nice with the
			// system in general.
			int counter = InlineScriptCounter++;
			InlineScriptResource script = new InlineScriptResource("inline" + counter, code, splitCommaDelimitedString(dependencies));
			PageScripts.Add(script);
		}
예제 #2
0
		/// <summary>
		/// Add a script with optional dependencies to the load sequence.
		/// </summary>
		/// <param name="codeChunkName">A name, in case you want to have other scripts depend on this one</param>
		/// <param name="code">The JS. No script tags. The code will run inside of a (function(){...}()) meaning any variables are isolated from
		/// other scripts on the page</param>
		/// <param name="dependencies">Optional. Scripts this code depends on. Pass null if none.</param>
		public void RunJsAfter(string codeChunkName, string code, string dependencies)
		{
			InlineScriptResource script = new InlineScriptResource(codeChunkName, code, splitCommaDelimitedString(dependencies));
			PageScripts.Add(script);
		}