<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>$.log &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/log/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Writing a jQuery plugin &#8211; (part 2). Sample plugin.</title>
		<link>/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/</link>
		<comments>/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/#respond</comments>
		<pubDate>Mon, 01 Feb 2010 05:21:45 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[$.log]]></category>
		<category><![CDATA[Computer science]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[logging]]></category>

		<guid isPermaLink="false">/?p=791</guid>
		<description><![CDATA[To be breve I’ll write some sample code and quickly describe it afterwards. So what’s a plugin. Lets make a simple logging plugin that overrides the console.log function and prevents MSIE browser to throw an error when this function misses. The thing I’d like to achieve is something like: $.log(‘my message’); when I call it &#8230; <a href="/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/" class="more-link">Continue reading <span class="screen-reader-text">Writing a jQuery plugin &#8211; (part 2). Sample plugin.</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/11/13/writing-a-jquery-plugin-part-1-good-practices/" rel="bookmark" title="Writing a jQuery plugin &#8211; (part 1). Good practices!">Writing a jQuery plugin &#8211; (part 1). Good practices! </a></li>
<li><a href="/2009/07/27/jquery-debug-plugin/" rel="bookmark" title="jQuery debug plugin">jQuery debug plugin </a></li>
<li><a href="/2009/11/10/jquery-css-functions-part-1-offset/" rel="bookmark" title="jQuery CSS functions. Part 1 &#8211; offset()">jQuery CSS functions. Part 1 &#8211; offset() </a></li>
<li><a href="/2010/02/17/clickoutside-jquery-plugin/" rel="bookmark" title="clickoutside jQuery plugin">clickoutside jQuery plugin </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>To be breve I’ll write some sample code and quickly describe it afterwards. So what’s a plugin. Lets make a simple logging plugin that overrides the console.log function and prevents MSIE browser to throw an error when this function misses.</p>
<p>The thing I’d like to achieve is something like:</p>
<blockquote>
<pre>$.log(‘my message’);</pre>
</blockquote>
<p>when I call it from a pure jQuery code.</p>
<blockquote>
<pre>function log( msg ) {
   console.log &amp;&amp; console.log(msg);
}</pre>
</blockquote>
<p>That code looks quite correct, but to make all this into a jQuery plugin will need something more.</p>
<blockquote>
<pre>(function(jquery) {

   var log = function( msg ) {
      console.log &amp;&amp; console.log(msg);
   };

   jquery.log = log;

}(jQuery));</pre>
</blockquote>
<p>After that we can call the <strong>$.log</strong> function with success and to perform logging of everything we want into the Firebug’s console.</p>
<p>The simple technique used here is a JavaScript closure and simple exportation of the single function log.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/11/13/writing-a-jquery-plugin-part-1-good-practices/" rel="bookmark" title="Writing a jQuery plugin &#8211; (part 1). Good practices!">Writing a jQuery plugin &#8211; (part 1). Good practices! </a></li>
<li><a href="/2009/07/27/jquery-debug-plugin/" rel="bookmark" title="jQuery debug plugin">jQuery debug plugin </a></li>
<li><a href="/2009/11/10/jquery-css-functions-part-1-offset/" rel="bookmark" title="jQuery CSS functions. Part 1 &#8211; offset()">jQuery CSS functions. Part 1 &#8211; offset() </a></li>
<li><a href="/2010/02/17/clickoutside-jquery-plugin/" rel="bookmark" title="clickoutside jQuery plugin">clickoutside jQuery plugin </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
