<?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>Techy Things &#187; requirejs</title>
	<atom:link href="https://tech.yipp.ca/category/requirejs/feed/" rel="self" type="application/rss+xml" />
	<link>https://tech.yipp.ca</link>
	<description>Just another Yipp.ca Blogs site</description>
	<lastBuildDate>Thu, 01 May 2025 18:06:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.38</generator>
	<item>
		<title>Singleton pattern in RequireJS</title>
		<link>https://tech.yipp.ca/requirejs/singleton-pattern-requirejs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=singleton-pattern-requirejs</link>
		<comments>https://tech.yipp.ca/requirejs/singleton-pattern-requirejs/#comments</comments>
		<pubDate>Sun, 23 Nov 2014 17:39:14 +0000</pubDate>
		<dc:creator><![CDATA[frank]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[requirejs]]></category>

		<guid isPermaLink="false">http://tech.yipp.ca/?p=1245</guid>
		<description><![CDATA[<p>Yes this is possible and has its advantage. I use it often for Toolbox-like functions. This is the basic approach define(function (require) { var singleton = function () { return { ... }; };&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/requirejs/singleton-pattern-requirejs/">Singleton pattern in RequireJS</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Yes this is possible and has its advantage. I use it often for Toolbox-like functions.</p>
<p>This is the basic approach</p>
<pre><code>define(function (require) {
    var singleton = function ()
    {
        return {
            ...
        };
    };
    return singleton();
});

Other approaches that are less ideal but work anyhow

This method uses the "new". It is good, but not needed as you can see in my code above.:  
https://gist.github.com/jasonwyatt/1106973

Some credit for this post goes to <a href="http://stackoverflow.com/users/644388/ggozad">ggozad</a> from stackoverflow :
http://stackoverflow.com/questions/9733201/is-it-a-bad-practice-to-use-the-requirejs-module-as-a-singleton

</code></pre>
<p>&nbsp;</p>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/requirejs/singleton-pattern-requirejs/">Singleton pattern in RequireJS</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://tech.yipp.ca/requirejs/singleton-pattern-requirejs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RequireJS error Uncaught Error: Module name &quot;xyz&quot; has not been loaded yet for context: _. Use require([])</title>
		<link>https://tech.yipp.ca/requirejs/qunit-error-uncaught-error-module-name-xyz-loaded-yet-context-_-use-require/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=qunit-error-uncaught-error-module-name-xyz-loaded-yet-context-_-use-require</link>
		<comments>https://tech.yipp.ca/requirejs/qunit-error-uncaught-error-module-name-xyz-loaded-yet-context-_-use-require/#comments</comments>
		<pubDate>Wed, 29 Oct 2014 21:24:10 +0000</pubDate>
		<dc:creator><![CDATA[frank]]></dc:creator>
				<category><![CDATA[requirejs]]></category>

		<guid isPermaLink="false">http://tech.yipp.ca/?p=1168</guid>
		<description><![CDATA[<p>Uncaught Error: Module name "player" has not been loaded yet for context: _. Use require([]) Solution: Add require to the list of parameters. Example : WRONG: define(function () { var Player = require('player'); ...&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/requirejs/qunit-error-uncaught-error-module-name-xyz-loaded-yet-context-_-use-require/">RequireJS error Uncaught Error: Module name "xyz" has not been loaded yet for context: _. Use require([])</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Uncaught Error: Module name "player" has not been loaded yet for context: _. Use require([])</p>
<p>Solution: Add require to the list of parameters. Example :</p>
<p>WRONG:<br />
define(function ()<br />
{<br />
var Player = require('player');<br />
...</p>
<p>GOOD:</p>
<p>define(function (<strong>require</strong>)<br />
{<br />
var Player = require('player');<br />
...</p>
<p>&nbsp;</p>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/requirejs/qunit-error-uncaught-error-module-name-xyz-loaded-yet-context-_-use-require/">RequireJS error Uncaught Error: Module name "xyz" has not been loaded yet for context: _. Use require([])</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://tech.yipp.ca/requirejs/qunit-error-uncaught-error-module-name-xyz-loaded-yet-context-_-use-require/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
