-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
48 lines (39 loc) · 2.46 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Lé Blog de Chasé]]></title>
<link href="http://jiggliemon.github.com/atom.xml" rel="self"/>
<link href="http://jiggliemon.github.com/"/>
<updated>2012-12-06T17:06:06-08:00</updated>
<id>http://jiggliemon.github.com/</id>
<author>
<name><![CDATA[Chase Wilson]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Custom Class constructors with interface enforcement with mootools]]></title>
<link href="http://jiggliemon.github.com/blog/2011/04/30/custom-class-constructors-with-interface-enforcement-in-mootools/"/>
<updated>2011-04-30T00:00:00-07:00</updated>
<id>http://jiggliemon.github.com/blog/2011/04/30/custom-class-constructors-with-interface-enforcement-in-mootools</id>
<content type="html"><![CDATA[<p>Chris Pojer’s Interface class mutates a class, and inforces a well architected interface on your class. The Interface is checked when the class’s “initialize” method is run. What we’re doing here is attaching a pre-defined interface to a new <code>Module</code> constructor. This module constructor ensures that the <code>namespace</code> property is declared - an is a string; Also it states that <code>theother</code> property is a function. This is how I enforce a particular class structure on the rest of the team for large scal projects.</p>
<p>For more information on this particular Interface mixin, look at <a href="http://cpojer.net/MooTools/interface/Demos/Example.js" target="_blank">this example</a> and download Chris Pojer’s interface <a href="https://github.com/cpojer/mootools-interface" target="_blank">here</a>.</p>
<pre><code>var TheModuleInterface = new Interface({
namespace: String,
theother: Function
});
var Module = new Type('Module', function (params){
// Mind the order. Your Interface needs to be the first argument when appending.
params = Object.append({ Interface: TheModuleInterface }, params || {} ) ;
return new Class(params);
});
var aModuleInstance = new Module({
theother: "some string",
namespace: {some:'object'},
initialize: function(){
// Remember your module needs an initialize method...
}
});
var theMod = new Mod(); // Uncaught Error: Property "namespace" is implemented but not an instance of "String"
</code></pre>
]]></content>
</entry>
</feed>