ninjs 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/ninjs +0 -0
- data/lib/ninjs/command.rb +1 -1
- data/ninjs.gemspec +6 -5
- data/repository/ninjs/core/application.js +2 -2
- data/repository/ninjs/core/existence.js +8 -8
- data/repository/ninjs/core/extend.js +50 -2
- data/repository/ninjs/core/module.js +1 -4
- data/repository/ninjs/docs/Data/ConfigFileInfo.nd +0 -0
- data/repository/ninjs/docs/Data/FileInfo.nd +3 -3
- data/repository/ninjs/docs/Data/IndexInfo.nd +0 -0
- data/repository/ninjs/docs/Data/SymbolTable.nd +0 -0
- data/repository/ninjs/docs/files/core/extend-js.html +1 -1
- data/repository/ninjs/docs/files/core/module-js.html +3 -3
- data/repository/ninjs/docs/index/Functions.html +11 -7
- data/repository/ninjs/docs/index/General.html +13 -9
- data/repository/ninjs/docs/javascript/searchdata.js +11 -11
- data/repository/ninjs/docs/search/FunctionsR.html +1 -1
- data/repository/ninjs/docs/search/FunctionsSymbols.html +20 -0
- data/repository/ninjs/docs/search/GeneralR.html +1 -1
- data/repository/ninjs/docs/search/GeneralSymbols.html +20 -0
- data/repository/ninjs/tests/ninjs.test.js +26 -4
- data/repository/ninjs/tests/ninjs.utilities.test.js +1 -1
- metadata +47 -7
- data/repository/ninjs/docs/files/existence-js.html +0 -54
- data/repository/ninjs/docs/styles/mystyles.css +0 -828
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.12.0
|
data/bin/ninjs
CHANGED
File without changes
|
data/lib/ninjs/command.rb
CHANGED
data/ninjs.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ninjs}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.12.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dayton Nolan"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-04-07}
|
13
13
|
s.default_executable = %q{ninjs}
|
14
14
|
s.description = %q{Ninjs is a ruby application and small javascript framework that helps you build clean, modular javascript applications. Ninjs encourages "Good Parts" best practices and the Crockford school Module pattern (http://www.crockford.com/). The ninjs command line application is an automatic compiler, written in ruby, and based on the Sprockets library (http://getsprockets.org/).}
|
15
15
|
s.email = %q{daytonn@gmail.com}
|
@@ -143,7 +143,6 @@ Gem::Specification.new do |s|
|
|
143
143
|
"repository/ninjs/docs/files/core/extend-js.html",
|
144
144
|
"repository/ninjs/docs/files/core/module-js.html",
|
145
145
|
"repository/ninjs/docs/files/core/nin-js.html",
|
146
|
-
"repository/ninjs/docs/files/existence-js.html",
|
147
146
|
"repository/ninjs/docs/index.html",
|
148
147
|
"repository/ninjs/docs/index/Classes.html",
|
149
148
|
"repository/ninjs/docs/index/Files.html",
|
@@ -165,6 +164,7 @@ Gem::Specification.new do |s|
|
|
165
164
|
"repository/ninjs/docs/search/FunctionsM.html",
|
166
165
|
"repository/ninjs/docs/search/FunctionsR.html",
|
167
166
|
"repository/ninjs/docs/search/FunctionsS.html",
|
167
|
+
"repository/ninjs/docs/search/FunctionsSymbols.html",
|
168
168
|
"repository/ninjs/docs/search/GeneralA.html",
|
169
169
|
"repository/ninjs/docs/search/GeneralC.html",
|
170
170
|
"repository/ninjs/docs/search/GeneralD.html",
|
@@ -175,6 +175,7 @@ Gem::Specification.new do |s|
|
|
175
175
|
"repository/ninjs/docs/search/GeneralN.html",
|
176
176
|
"repository/ninjs/docs/search/GeneralR.html",
|
177
177
|
"repository/ninjs/docs/search/GeneralS.html",
|
178
|
+
"repository/ninjs/docs/search/GeneralSymbols.html",
|
178
179
|
"repository/ninjs/docs/search/GeneralT.html",
|
179
180
|
"repository/ninjs/docs/search/GeneralV.html",
|
180
181
|
"repository/ninjs/docs/search/NoResults.html",
|
@@ -183,7 +184,6 @@ Gem::Specification.new do |s|
|
|
183
184
|
"repository/ninjs/docs/search/VariablesR.html",
|
184
185
|
"repository/ninjs/docs/search/VariablesT.html",
|
185
186
|
"repository/ninjs/docs/styles/main.css",
|
186
|
-
"repository/ninjs/docs/styles/mystyles.css",
|
187
187
|
"repository/ninjs/tests/index.html",
|
188
188
|
"repository/ninjs/tests/ninjs.test.js",
|
189
189
|
"repository/ninjs/tests/ninjs.utilities.test.js",
|
@@ -310,7 +310,7 @@ Gem::Specification.new do |s|
|
|
310
310
|
s.licenses = ["MIT"]
|
311
311
|
s.require_paths = ["lib"]
|
312
312
|
s.rubyforge_project = %q{nowarning}
|
313
|
-
s.rubygems_version = %q{1.
|
313
|
+
s.rubygems_version = %q{1.3.7}
|
314
314
|
s.summary = %q{ninjs is a command line application to help you write clean, modular javascript applications.}
|
315
315
|
s.test_files = [
|
316
316
|
"spec/ninjs_spec.rb",
|
@@ -318,6 +318,7 @@ Gem::Specification.new do |s|
|
|
318
318
|
]
|
319
319
|
|
320
320
|
if s.respond_to? :specification_version then
|
321
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
321
322
|
s.specification_version = 3
|
322
323
|
|
323
324
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -2,7 +2,7 @@
|
|
2
2
|
if (is_defined === undefined) {
|
3
3
|
/*
|
4
4
|
Function: is_defined
|
5
|
-
Checks if a variable is undefined.
|
5
|
+
Checks if a variable is undefined. This is a convenience method to enhance clarity in your conditions.
|
6
6
|
|
7
7
|
Parameters:
|
8
8
|
suspect - suspect variable to test
|
@@ -15,14 +15,14 @@ if (is_defined === undefined) {
|
|
15
15
|
<is_undefined>
|
16
16
|
*/
|
17
17
|
var is_defined = function(suspect) {
|
18
|
-
return (suspect === undefined) ? false : true;
|
18
|
+
return ((suspect === undefined) || (suspect === null)) ? false : true;
|
19
19
|
};
|
20
20
|
}
|
21
21
|
|
22
22
|
if (!is_defined(is_undefined)) {
|
23
23
|
/*
|
24
24
|
Function: is_undefined
|
25
|
-
Checks if a variable is defined.
|
25
|
+
Checks if a variable is defined. This is a convenience method to enhance clarity in your conditions.
|
26
26
|
|
27
27
|
Parameters:
|
28
28
|
suspect - suspect variable to test
|
@@ -42,11 +42,11 @@ if (!is_defined(is_undefined)) {
|
|
42
42
|
if (is_undefined(is_typeof)) {
|
43
43
|
/*
|
44
44
|
Function: is_typeof
|
45
|
-
|
46
|
-
|
45
|
+
Strict type checking by comparing constructors.
|
46
|
+
(Pro Javascript Techniques, John Resig, Apress p.24 Listing 2-8: Example of using the constructor property to determine the type of an object http://amzn.to/fTsDRg)
|
47
47
|
Parameters:
|
48
|
-
type - The type you expect (ie. String, Number, Array without quotes: is_typeof(String, 'hello'): // true)
|
49
|
-
suspect - The variable to check against type
|
48
|
+
type - The type you expect (ie. String, Number, Array (note: without quotes): is_typeof(String, 'hello'): // true)
|
49
|
+
suspect - The suspect variable to check against type
|
50
50
|
|
51
51
|
Returns:
|
52
52
|
bool
|
@@ -81,7 +81,7 @@ if (is_undefined(is_numeric)) {
|
|
81
81
|
/*
|
82
82
|
Function: is_numeric
|
83
83
|
Determine if the suspect string represents a numeric value.
|
84
|
-
|
84
|
+
(JavaScript: The Good Parts, Douglas Crockford, O'Reilly p.69 Chapter 7: Regular Expressions An Example)
|
85
85
|
Parameters:
|
86
86
|
suspect - variable to check for numeric value
|
87
87
|
|
@@ -4,14 +4,14 @@
|
|
4
4
|
if (is_undefined(Function.prototype['method'])) {
|
5
5
|
/*
|
6
6
|
Function: method
|
7
|
-
Method to add a method to an object (ie. String.method('my_method', my_func);
|
7
|
+
Method to add a method to an object (ie. String.method('my_method', my_func); // 'hello'.my_method())
|
8
8
|
|
9
9
|
Parameters:
|
10
10
|
name - name of the method
|
11
11
|
func - function definition
|
12
12
|
|
13
13
|
Returns:
|
14
|
-
this
|
14
|
+
this (chainable)
|
15
15
|
|
16
16
|
> String.method('custom_method', function() {
|
17
17
|
> // define custom_method
|
@@ -37,4 +37,52 @@ if (is_undefined(Function.prototype['method'])) {
|
|
37
37
|
alert(error.message);
|
38
38
|
}
|
39
39
|
};
|
40
|
+
}
|
41
|
+
|
42
|
+
if (is_undefined(unless)) {
|
43
|
+
/*
|
44
|
+
Function: unless
|
45
|
+
Function to better express negative conditions (ie. if (!something))
|
46
|
+
|
47
|
+
Parameters:
|
48
|
+
expression - expression to be tested
|
49
|
+
callback - function to be executed unless expression is true (see how that works)
|
50
|
+
fallback - function to be executed if the expression is false (optional)
|
51
|
+
|
52
|
+
Returns:
|
53
|
+
undefined
|
54
|
+
|
55
|
+
> unless(test_expression === 'some condition',
|
56
|
+
> function() {
|
57
|
+
> alert('we do something');
|
58
|
+
> },
|
59
|
+
> function() {
|
60
|
+
> alert('we can do something if it meets the condition too');
|
61
|
+
> }
|
62
|
+
> );
|
63
|
+
>
|
64
|
+
> "hello".custom_method();
|
65
|
+
*/
|
66
|
+
var unless = function(expression, callback, fallback) {
|
67
|
+
try {
|
68
|
+
if (is_undefined(expression)) {
|
69
|
+
throw new SyntaxError("unless(expression, callback[, fallback]): expression is undefined");
|
70
|
+
}
|
71
|
+
|
72
|
+
if (is_undefined(callback)) {
|
73
|
+
throw new SyntaxError("unless(expression, callback[, fallback]): callback is undefined");
|
74
|
+
}
|
75
|
+
|
76
|
+
// This kind of expression is exactly why we NEED unless
|
77
|
+
if (!expression) {
|
78
|
+
callback.call(this);
|
79
|
+
}
|
80
|
+
else if (is_defined(fallback)) {
|
81
|
+
fallback.call(this);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
catch(error) {
|
85
|
+
alert(error.message);
|
86
|
+
}
|
87
|
+
};
|
40
88
|
}
|
@@ -90,10 +90,7 @@ NinjsModule.method('call_on_ready', function(callback) {
|
|
90
90
|
|
91
91
|
> MyModule.execute();
|
92
92
|
*/
|
93
|
-
NinjsModule.method('execute', function() {
|
94
|
-
// create the __ alias
|
95
|
-
window.__ = this;
|
96
|
-
|
93
|
+
NinjsModule.method('execute', function() {
|
97
94
|
if (this.run_tests) {
|
98
95
|
this._run_tests();
|
99
96
|
}
|
Binary file
|
@@ -6,11 +6,11 @@ JavaScript
|
|
6
6
|
/Volumes/Storage/Development/ninjs/repository/ninjs/utilities/number.js 1295331490 0 /Volumes/Storage/Development/ninjs/repository/ninjs/utilities/number.js
|
7
7
|
/Volumes/Storage/Development/ninjs/repository/ninjs/utilities/all.js 1295497444 0 /Volumes/Storage/Development/ninjs/repository/ninjs/utilities/all.js
|
8
8
|
/Volumes/Storage/Development/ninjs/repository/ninjs/core/existence.js 1295843594 1 existence.js
|
9
|
-
/Volumes/Storage/Development/ninjs/repository/ninjs/core/application.js
|
10
|
-
/Volumes/Storage/Development/ninjs/repository/ninjs/core/module.js
|
9
|
+
/Volumes/Storage/Development/ninjs/repository/ninjs/core/application.js 1296341951 1 application.js
|
10
|
+
/Volumes/Storage/Development/ninjs/repository/ninjs/core/module.js 1299733299 1 module.js
|
11
11
|
/Volumes/Storage/Development/ninjs/repository/ninjs/utilities/cookie.js 1295499140 0 /Volumes/Storage/Development/ninjs/repository/ninjs/utilities/cookie.js
|
12
12
|
/Volumes/Storage/Development/ninjs/repository/ninjs/tests/qunit/qunit.js 1294856988 0 /Volumes/Storage/Development/ninjs/repository/ninjs/tests/qunit/qunit.js
|
13
13
|
/Volumes/Storage/Development/ninjs/repository/ninjs/utilities/array.js 1295331421 0 /Volumes/Storage/Development/ninjs/repository/ninjs/utilities/array.js
|
14
14
|
/Volumes/Storage/Development/ninjs/repository/ninjs/utilities/string.js 1295331396 0 /Volumes/Storage/Development/ninjs/repository/ninjs/utilities/string.js
|
15
15
|
/Volumes/Storage/Development/ninjs/repository/ninjs/tests/ninjs.test.js 1295405794 0 /Volumes/Storage/Development/ninjs/repository/ninjs/tests/ninjs.test.js
|
16
|
-
/Volumes/Storage/Development/ninjs/repository/ninjs/core/extend.js
|
16
|
+
/Volumes/Storage/Development/ninjs/repository/ninjs/core/extend.js 1299735328 1 extend.js
|
Binary file
|
Binary file
|
@@ -15,7 +15,7 @@ if (browserType) {document.write("<div class=" + browserType + ">");if (browserV
|
|
15
15
|
|
16
16
|
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Functions"></a>Functions</h3></div></div>
|
17
17
|
|
18
|
-
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="method"></a>method</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>Function.prototype.method = function(</td><td class="PParameter prettyprint " nowrap>name,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>func</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Method to add a method to an object (ie. String.method(‘my_method’, my_func);
|
18
|
+
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="method"></a>method</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>Function.prototype.method = function(</td><td class="PParameter prettyprint " nowrap>name,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>func</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Method to add a method to an object (ie. String.method(‘my_method’, my_func); // ‘hello’.my_method())</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>name</td><td class=CDLDescription>name of the method</td></tr><tr><td class=CDLEntry>func</td><td class=CDLDescription>function definition</td></tr></table><h4 class=CHeading>Returns</h4><p>this (chainable)</p><blockquote><pre>String.method('custom_method', function() {
|
19
19
|
// define custom_method
|
20
20
|
});
|
21
21
|
|
@@ -11,9 +11,9 @@ if (browserType) {document.write("<div class=" + browserType + ">");if (browserV
|
|
11
11
|
|
12
12
|
|
13
13
|
|
14
|
-
<div id=Content><div class="CFile"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="module.js"></a>module.js</h1><div class=CBody><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#module.js" >module.js</a></td><td class=SDescription></td></tr><tr class="SClass"><td class=SEntry><a href="#NinjsModule" >NinjsModule</a></td><td class=SDescription>A NinjsModule is an object which encapsulates a certain behavior or functionality.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#NinjsModule.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.data" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">data</a></td><td class=SDescription>The module’s data object</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#NinjsModule.name" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">name</a></td><td class=SDescription>The module’s name (string)</td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.run_tests(beta)" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">run_tests (beta)</a></td><td class=SDescription>Boolean to turn tests on/off</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#NinjsModule.tests(beta)" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">tests (beta)</a></td><td class=SDescription>Array of test files to run</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#NinjsModule.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.actions" >actions</a></td><td class=SDescription>The actions method contains code to be executed when run is called. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#NinjsModule.run" >run</a></td><td class=SDescription>Waits for the DOM to load then calls execute.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.call_on_ready" >call_on_ready</a></td><td class=SDescription>Waits for the DOM to be ready and then executes a callback.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#NinjsModule.execute" >execute</a></td><td class=SDescription>Wrapper method that set’s up the environment and then calls actions.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.elements" >elements</a></td><td class=SDescription>Method to define module elements.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#NinjsModule.set_data" >set_data</a></td><td class=SDescription>Adds properties to the module’s data object.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.add_test" >add_test</a></td><td class=SDescription>Adds a test file to the tests array (beta).</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#NinjsModule.
|
14
|
+
<div id=Content><div class="CFile"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="module.js"></a>module.js</h1><div class=CBody><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#module.js" >module.js</a></td><td class=SDescription></td></tr><tr class="SClass"><td class=SEntry><a href="#NinjsModule" >NinjsModule</a></td><td class=SDescription>A NinjsModule is an object which encapsulates a certain behavior or functionality.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#NinjsModule.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.data" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">data</a></td><td class=SDescription>The module’s data object</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#NinjsModule.name" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">name</a></td><td class=SDescription>The module’s name (string)</td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.run_tests(beta)" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">run_tests (beta)</a></td><td class=SDescription>Boolean to turn tests on/off</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#NinjsModule.tests(beta)" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">tests (beta)</a></td><td class=SDescription>Array of test files to run</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#NinjsModule.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.actions" >actions</a></td><td class=SDescription>The actions method contains code to be executed when run is called. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#NinjsModule.run" >run</a></td><td class=SDescription>Waits for the DOM to load then calls execute.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.call_on_ready" >call_on_ready</a></td><td class=SDescription>Waits for the DOM to be ready and then executes a callback.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#NinjsModule.execute" >execute</a></td><td class=SDescription>Wrapper method that set’s up the environment and then calls actions.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.elements" >elements</a></td><td class=SDescription>Method to define module elements.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#NinjsModule.set_data" >set_data</a></td><td class=SDescription>Adds properties to the module’s data object.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#NinjsModule.add_test" >add_test</a></td><td class=SDescription>Adds a test file to the tests array (beta).</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#NinjsModule._run_tests" >_run_tests</a></td><td class=SDescription>Runs the test files in the test array. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
|
15
15
|
|
16
|
-
<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="NinjsModule"></a>NinjsModule</h2><div class=CBody><p>A NinjsModule is an object which encapsulates a certain behavior or functionality.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>name</td><td class=CDLDescription>the name of the module</td></tr></table><h4 class=CHeading>See Also</h4><p><a href="application-js.html#NinjsApplication" class=LClass id=link9 onMouseOver="ShowTip(event, 'tt5', 'link9')" onMouseOut="HideTip('tt5')">NinjsApplication</a></p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#NinjsModule.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.data" id=link5 onMouseOver="ShowTip(event, 'tt1', 'link5')" onMouseOut="HideTip('tt1')">data</a></td><td class=SDescription>The module’s data object</td></tr><tr class="SVariable SIndent1"><td class=SEntry><a href="#NinjsModule.name" id=link6 onMouseOver="ShowTip(event, 'tt2', 'link6')" onMouseOut="HideTip('tt2')">name</a></td><td class=SDescription>The module’s name (string)</td></tr><tr class="SVariable SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.run_tests(beta)" id=link7 onMouseOver="ShowTip(event, 'tt3', 'link7')" onMouseOut="HideTip('tt3')">run_tests (beta)</a></td><td class=SDescription>Boolean to turn tests on/off</td></tr><tr class="SVariable SIndent1"><td class=SEntry><a href="#NinjsModule.tests(beta)" id=link8 onMouseOver="ShowTip(event, 'tt4', 'link8')" onMouseOut="HideTip('tt4')">tests (beta)</a></td><td class=SDescription>Array of test files to run</td></tr><tr class="SGroup"><td class=SEntry><a href="#NinjsModule.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.actions" >actions</a></td><td class=SDescription>The actions method contains code to be executed when run is called. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#NinjsModule.run" >run</a></td><td class=SDescription>Waits for the DOM to load then calls execute.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.call_on_ready" >call_on_ready</a></td><td class=SDescription>Waits for the DOM to be ready and then executes a callback.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#NinjsModule.execute" >execute</a></td><td class=SDescription>Wrapper method that set’s up the environment and then calls actions.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.elements" >elements</a></td><td class=SDescription>Method to define module elements.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#NinjsModule.set_data" >set_data</a></td><td class=SDescription>Adds properties to the module’s data object.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.add_test" >add_test</a></td><td class=SDescription>Adds a test file to the tests array (beta).</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#NinjsModule.
|
16
|
+
<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="NinjsModule"></a>NinjsModule</h2><div class=CBody><p>A NinjsModule is an object which encapsulates a certain behavior or functionality.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>name</td><td class=CDLDescription>the name of the module</td></tr></table><h4 class=CHeading>See Also</h4><p><a href="application-js.html#NinjsApplication" class=LClass id=link9 onMouseOver="ShowTip(event, 'tt5', 'link9')" onMouseOut="HideTip('tt5')">NinjsApplication</a></p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#NinjsModule.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.data" id=link5 onMouseOver="ShowTip(event, 'tt1', 'link5')" onMouseOut="HideTip('tt1')">data</a></td><td class=SDescription>The module’s data object</td></tr><tr class="SVariable SIndent1"><td class=SEntry><a href="#NinjsModule.name" id=link6 onMouseOver="ShowTip(event, 'tt2', 'link6')" onMouseOut="HideTip('tt2')">name</a></td><td class=SDescription>The module’s name (string)</td></tr><tr class="SVariable SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.run_tests(beta)" id=link7 onMouseOver="ShowTip(event, 'tt3', 'link7')" onMouseOut="HideTip('tt3')">run_tests (beta)</a></td><td class=SDescription>Boolean to turn tests on/off</td></tr><tr class="SVariable SIndent1"><td class=SEntry><a href="#NinjsModule.tests(beta)" id=link8 onMouseOver="ShowTip(event, 'tt4', 'link8')" onMouseOut="HideTip('tt4')">tests (beta)</a></td><td class=SDescription>Array of test files to run</td></tr><tr class="SGroup"><td class=SEntry><a href="#NinjsModule.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.actions" >actions</a></td><td class=SDescription>The actions method contains code to be executed when run is called. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#NinjsModule.run" >run</a></td><td class=SDescription>Waits for the DOM to load then calls execute.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.call_on_ready" >call_on_ready</a></td><td class=SDescription>Waits for the DOM to be ready and then executes a callback.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#NinjsModule.execute" >execute</a></td><td class=SDescription>Wrapper method that set’s up the environment and then calls actions.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.elements" >elements</a></td><td class=SDescription>Method to define module elements.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#NinjsModule.set_data" >set_data</a></td><td class=SDescription>Adds properties to the module’s data object.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#NinjsModule.add_test" >add_test</a></td><td class=SDescription>Adds a test file to the tests array (beta).</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#NinjsModule._run_tests" >_run_tests</a></td><td class=SDescription>Runs the test files in the test array. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
|
17
17
|
|
18
18
|
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="NinjsModule.Variables"></a>Variables</h3></div></div>
|
19
19
|
|
@@ -53,7 +53,7 @@ MyModule.data.property_two === 'value_two'</pre></blockquote></div></div></div>
|
|
53
53
|
|
54
54
|
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="NinjsModule.add_test"></a>add_test</h3><div class=CBody><p>Adds a test file to the tests array (beta).</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>test_file</td><td class=CDLDescription>File to add to the tests array</td></tr></table><blockquote><pre>MyModule.add_test('mytest.test.js');</pre></blockquote></div></div></div>
|
55
55
|
|
56
|
-
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="NinjsModule.
|
56
|
+
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="NinjsModule._run_tests"></a>_run_tests</h3><div class=CBody><p>Runs the test files in the test array. This method is automatically called by the execute method if run_tests === true</p></div></div></div>
|
57
57
|
|
58
58
|
</div><!--Content-->
|
59
59
|
|
@@ -11,29 +11,33 @@ if (browserType) {document.write("<div class=" + browserType + ">");if (browserV
|
|
11
11
|
|
12
12
|
|
13
13
|
|
14
|
-
<div id=Index><div class=IPageTitle>Function Index</div><div class=INavigationBar
|
14
|
+
<div id=Index><div class=IPageTitle>Function Index</div><div class=INavigationBar><a href="#Symbols">$#!</a> · 0-9 · <a href="#A">A</a> · B · <a href="#C">C</a> · D · <a href="#E">E</a> · F · G · H · <a href="#I">I</a> · J · K · L · <a href="#M">M</a> · N · O · P · Q · <a href="#R">R</a> · <a href="#S">S</a> · T · U · V · W · X · Y · Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="Symbols"></a>$#!</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix> </td><td class=IEntry><a href="../files/core/module-js.html#NinjsModule._run_tests" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>_run_tests</a>, <span class=IParent>NinjsModule</span></td></tr><tr><td class=IHeading><a name="A"></a>A</td><td></td></tr><tr><td class=ISymbolPrefix id=IFirstSymbolPrefix> </td><td class=IEntry><a href="../files/core/module-js.html#NinjsModule.actions" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')" class=ISymbol>actions</a>, <span class=IParent>NinjsModule</span></td></tr><tr><td class=ISymbolPrefix> </td><td class=IEntry><a href="../files/core/application-js.html#NinjsApplication.add_module" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')" class=ISymbol>add_module</a>, <span class=IParent>NinjsApplication</span></td></tr><tr><td class=ISymbolPrefix id=ILastSymbolPrefix> </td><td class=IEntry><a href="../files/core/module-js.html#NinjsModule.add_test" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')" class=ISymbol>add_test</a>, <span class=IParent>NinjsModule</span></td></tr><tr><td class=IHeading><a name="C"></a>C</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix> </td><td class=IEntry><a href="../files/core/module-js.html#NinjsModule.call_on_ready" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')" class=ISymbol>call_on_ready</a>, <span class=IParent>NinjsModule</span></td></tr><tr><td class=IHeading><a name="E"></a>E</td><td></td></tr><tr><td class=ISymbolPrefix id=IFirstSymbolPrefix> </td><td class=IEntry><a href="../files/core/module-js.html#NinjsModule.elements" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')" class=ISymbol>elements</a>, <span class=IParent>NinjsModule</span></td></tr><tr><td class=ISymbolPrefix id=ILastSymbolPrefix> </td><td class=IEntry><a href="../files/core/module-js.html#NinjsModule.execute" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')" class=ISymbol>execute</a>, <span class=IParent>NinjsModule</span></td></tr><tr><td class=IHeading><a name="I"></a>I</td><td></td></tr><tr><td class=ISymbolPrefix id=IFirstSymbolPrefix> </td><td class=IEntry><a href="../files/core/existence-js.html#is_array" id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')" class=ISymbol>is_array</a></td></tr><tr><td class=ISymbolPrefix> </td><td class=IEntry><a href="../files/core/existence-js.html#is_bool" id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')" class=ISymbol>is_bool</a></td></tr><tr><td class=ISymbolPrefix> </td><td class=IEntry><a href="../files/core/existence-js.html#is_date" id=link10 onMouseOver="ShowTip(event, 'tt10', 'link10')" onMouseOut="HideTip('tt10')" class=ISymbol>is_date</a></td></tr><tr><td class=ISymbolPrefix> </td><td class=IEntry><a href="../files/core/existence-js.html#is_defined" id=link11 onMouseOver="ShowTip(event, 'tt11', 'link11')" onMouseOut="HideTip('tt11')" class=ISymbol>is_defined</a></td></tr><tr><td class=ISymbolPrefix> </td><td class=IEntry><a href="../files/core/existence-js.html#is_number" id=link12 onMouseOver="ShowTip(event, 'tt12', 'link12')" onMouseOut="HideTip('tt12')" class=ISymbol>is_number</a></td></tr><tr><td class=ISymbolPrefix> </td><td class=IEntry><a href="../files/core/existence-js.html#is_numeric" id=link13 onMouseOver="ShowTip(event, 'tt13', 'link13')" onMouseOut="HideTip('tt13')" class=ISymbol>is_numeric</a></td></tr><tr><td class=ISymbolPrefix> </td><td class=IEntry><a href="../files/core/existence-js.html#is_regex" id=link14 onMouseOver="ShowTip(event, 'tt14', 'link14')" onMouseOut="HideTip('tt14')" class=ISymbol>is_regex</a></td></tr><tr><td class=ISymbolPrefix> </td><td class=IEntry><a href="../files/core/existence-js.html#is_string" id=link15 onMouseOver="ShowTip(event, 'tt15', 'link15')" onMouseOut="HideTip('tt15')" class=ISymbol>is_string</a></td></tr><tr><td class=ISymbolPrefix> </td><td class=IEntry><a href="../files/core/existence-js.html#is_typeof" id=link16 onMouseOver="ShowTip(event, 'tt16', 'link16')" onMouseOut="HideTip('tt16')" class=ISymbol>is_typeof</a></td></tr><tr><td class=ISymbolPrefix id=ILastSymbolPrefix> </td><td class=IEntry><a href="../files/core/existence-js.html#is_undefined" id=link17 onMouseOver="ShowTip(event, 'tt17', 'link17')" onMouseOut="HideTip('tt17')" class=ISymbol>is_undefined</a></td></tr><tr><td class=IHeading><a name="M"></a>M</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix> </td><td class=IEntry><a href="../files/core/extend-js.html#method" id=link18 onMouseOver="ShowTip(event, 'tt18', 'link18')" onMouseOut="HideTip('tt18')" class=ISymbol>method</a></td></tr><tr><td class=IHeading><a name="R"></a>R</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix> </td><td class=IEntry><a href="../files/core/module-js.html#NinjsModule.run" id=link19 onMouseOver="ShowTip(event, 'tt19', 'link19')" onMouseOut="HideTip('tt19')" class=ISymbol>run</a>, <span class=IParent>NinjsModule</span></td></tr><tr><td class=IHeading><a name="S"></a>S</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix> </td><td class=IEntry><a href="../files/core/module-js.html#NinjsModule.set_data" id=link20 onMouseOver="ShowTip(event, 'tt20', 'link20')" onMouseOut="HideTip('tt20')" class=ISymbol>set_data</a>, <span class=IParent>NinjsModule</span></td></tr></table>
|
15
15
|
<!--START_ND_TOOLTIPS-->
|
16
|
-
<div class=CToolTip id="tt1"><div class=CFunction>
|
16
|
+
<div class=CToolTip id="tt1"><div class=CFunction>Runs the test files in the test array. </div></div><!--END_ND_TOOLTIPS-->
|
17
17
|
|
18
18
|
|
19
19
|
<!--START_ND_TOOLTIPS-->
|
20
|
-
<div class=CToolTip id="
|
20
|
+
<div class=CToolTip id="tt2"><div class=CFunction>The actions method contains code to be executed when run is called. </div></div><div class=CToolTip id="tt3"><div class=CFunction>Adds a NinjsModule to the application.</div></div><div class=CToolTip id="tt4"><div class=CFunction>Adds a test file to the tests array (beta).</div></div><!--END_ND_TOOLTIPS-->
|
21
21
|
|
22
22
|
|
23
23
|
<!--START_ND_TOOLTIPS-->
|
24
|
-
<div class=CToolTip id="tt5"><div class=CFunction>
|
24
|
+
<div class=CToolTip id="tt5"><div class=CFunction>Waits for the DOM to be ready and then executes a callback.</div></div><!--END_ND_TOOLTIPS-->
|
25
25
|
|
26
26
|
|
27
27
|
<!--START_ND_TOOLTIPS-->
|
28
|
-
<div class=CToolTip id="
|
28
|
+
<div class=CToolTip id="tt6"><div class=CFunction>Method to define module elements.</div></div><div class=CToolTip id="tt7"><div class=CFunction>Wrapper method that set’s up the environment and then calls actions.</div></div><!--END_ND_TOOLTIPS-->
|
29
29
|
|
30
30
|
|
31
31
|
<!--START_ND_TOOLTIPS-->
|
32
|
-
<div class=CToolTip id="
|
32
|
+
<div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>var is_array = function(</td><td class="PParameter prettyprint " nowrap>suspect</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Determine if the suspect is an Array. </div></div><div class=CToolTip id="tt9"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>var is_bool = function(</td><td class="PParameter prettyprint " nowrap>suspect</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Determines if the suspect is a Boolean. </div></div><div class=CToolTip id="tt10"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>var is_date = function(</td><td class="PParameter prettyprint " nowrap>suspect</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Determines if the suspect is a Date. </div></div><div class=CToolTip id="tt11"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>var is_defined = function(</td><td class="PParameter prettyprint " nowrap>suspect</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Checks if a variable is undefined.</div></div><div class=CToolTip id="tt12"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>var is_number = function(</td><td class="PParameter prettyprint " nowrap>suspect</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Determines if the suspect is a Number. </div></div><div class=CToolTip id="tt13"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>var is_numeric = function(</td><td class="PParameter prettyprint " nowrap>suspect</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Determine if the suspect string represents a numeric value.</div></div><div class=CToolTip id="tt14"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>var is_regex = function(</td><td class="PParameter prettyprint " nowrap>suspect</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Determines if the suspect is a RegExp. </div></div><div class=CToolTip id="tt15"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>var is_string = function(</td><td class="PParameter prettyprint " nowrap>suspect</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Determine the suspect is a String. </div></div><div class=CToolTip id="tt16"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>var is_typeof = function(</td><td class="PParameter prettyprint " nowrap>type,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>suspect</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Determine an object’s type strictly by comparing constructors.</div></div><div class=CToolTip id="tt17"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>var is_undefined = function(</td><td class="PParameter prettyprint " nowrap>suspect</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Checks if a variable is defined.</div></div><!--END_ND_TOOLTIPS-->
|
33
33
|
|
34
34
|
|
35
35
|
<!--START_ND_TOOLTIPS-->
|
36
|
-
<div class=CToolTip id="tt18"><div class=CFunction
|
36
|
+
<div class=CToolTip id="tt18"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>Function.prototype.method = function(</td><td class="PParameter prettyprint " nowrap>name,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>func</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Method to add a method to an object (ie. </div></div><!--END_ND_TOOLTIPS-->
|
37
|
+
|
38
|
+
|
39
|
+
<!--START_ND_TOOLTIPS-->
|
40
|
+
<div class=CToolTip id="tt19"><div class=CFunction>Waits for the DOM to load then calls execute.</div></div><!--END_ND_TOOLTIPS-->
|
37
41
|
|
38
42
|
|
39
43
|
<!--START_ND_TOOLTIPS-->
|