Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/docs/symbols/Karma.html
blob: 63a4dc640afa952760132125d239222cb52b7010 (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta name="generator" content="JsDoc Toolkit" />
		
		<title>JsDoc Reference - Karma</title>

		<style type="text/css">
			/* default.css */
body
{
	font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
	width: 800px;
}

.header
{
	clear: both;
	background-color: #ccc;
	padding: 8px;
}

h1
{
	font-size: 150%;
	font-weight: bold;
	padding: 0;
	margin: 1em 0 0 .3em;
}

hr
{
	border: none 0;
	border-top: 1px solid #7F8FB1;
	height: 1px;
}

pre.code
{
	display: block;
	padding: 8px;
	border: 1px dashed #ccc;
}

#index
{
	margin-top: 24px;
	float: left;
	width: 160px;
	position: absolute;
	left: 8px;
	background-color: #F3F3F3;
	padding: 8px;
}

#content
{
	margin-left: 190px;
	width: 600px;
}

.classList
{
	list-style-type: none;
	padding: 0;
	margin: 0 0 0 8px;
	font-family: arial, sans-serif;
	font-size: 1em;
	overflow: auto;
}

.classList li
{
	padding: 0;
	margin: 0 0 8px 0;
}

.summaryTable { width: 100%; }

h1.classTitle
{
	font-size:170%;
	line-height:130%;
}

h2 { font-size: 110%; }
caption, div.sectionTitle
{
	background-color: #7F8FB1;
	color: #fff;
	font-size:130%;
	text-align: left;
	padding: 2px 6px 2px 6px;
	border: 1px #7F8FB1 solid;
}

div.sectionTitle { margin-bottom: 8px; }
.summaryTable thead { display: none; }

.summaryTable td
{
	vertical-align: top;
	padding: 4px;
	border-bottom: 1px #7F8FB1 solid;
	border-right: 1px #7F8FB1 solid;
}

/*col#summaryAttributes {}*/
.summaryTable td.attributes
{
	border-left: 1px #7F8FB1 solid;
	width: 140px;
	text-align: right;
}

td.attributes, .fixedFont
{
	line-height: 15px;
	color: #002EBE;
	font-family: "Courier New",Courier,monospace;
	font-size: 13px;
}

.summaryTable td.nameDescription
{
	text-align: left;
	font-size: 13px;
	line-height: 15px;
}

.summaryTable td.nameDescription, .description
{
	line-height: 15px;
	padding: 4px;
	padding-left: 4px;
}

.summaryTable { margin-bottom: 8px; }

ul.inheritsList
{
	list-style: square;
	margin-left: 20px;
	padding-left: 0;
}

.detailList {
	margin-left: 20px; 
	line-height: 15px;
}
.detailList dt { margin-left: 20px; }

.detailList .heading
{
	font-weight: bold;
	padding-bottom: 6px;
	margin-left: 0;
}

.light, td.attributes, .light a:link, .light a:visited
{
	color: #777;
	font-style: italic;
}

.fineprint
{
	text-align: right;
	font-size: 10px;
}
		</style>
	</head>

	<body>
<!-- ============================== header ================================= -->	
		<!-- begin static/header.html -->
		<div id="header">
</div>
		<!-- end static/header.html -->

<!-- ============================== classes index ============================ -->
		<div id="index">
			<!-- begin publish.classesIndex -->
			<div align="center"><a href="../index.html">Class Index</a>
| <a href="../files.html">File Index</a></div>
<hr />
<h2>Classes</h2>
<ul class="classList">
	
	<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
	
	<li><a href="../symbols/Karma.html">Karma</a></li>
	
	<li><a href="../symbols/Karma.karma.html">Karma.karma</a></li>
	
	<li><a href="../symbols/Karma.kAudio.html">Karma.kAudio</a></li>
	
	<li><a href="../symbols/Karma.kCanvas.html">Karma.kCanvas</a></li>
	
	<li><a href="../symbols/Karma.kImage.html">Karma.kImage</a></li>
	
	<li><a href="../symbols/Karma.kSvg.html">Karma.kSvg</a></li>
	
	<li><a href="../symbols/Karma.kVideo.html">Karma.kVideo</a></li>
	
</ul>
<hr />
			<!-- end publish.classesIndex -->
		</div>
		
		<div id="content">
<!-- ============================== class title ============================ -->
			<h1 class="classTitle">
				
				Namespace Karma
			</h1>

<!-- ============================== class summary ========================== -->			
			<p class="description">
				
				
			
				Global namespace for Karma library
				
				
					<br /><i>Defined in: </i> <a href="../symbols/src/js_karma.js.html">karma.js</a>.
				
			</p>

<!-- ============================== constructor summary ==================== -->			
			
			<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class Karma.">
				<caption>Namespace Summary</caption>
				<thead>
					<tr>
						<th scope="col">Constructor Attributes</th>
						<th scope="col">Constructor Name and Description</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td class="attributes">&nbsp;</td>
						<td class="nameDescription" >
							<div class="fixedFont">
								<b><a href="../symbols/Karma.html#constructor">Karma</a></b>
							</div>
							<div class="description">Karma is the namespace for the Karma library and Karma() is the constructor 
function for the Karma library object Karma.karma.</div>
						</td>
					</tr>
				</tbody>
			</table>
			

<!-- ============================== properties summary ===================== -->
			

<!-- ============================== methods summary ======================== -->
			
				
				
				<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class Karma.">
					<caption>Method Summary</caption>
					<thead>
						<tr>
							<th scope="col">Method Attributes</th>
							<th scope="col">Method Name and Description</th>
						</tr>
					</thead>
					<tbody>
					
						<tr>
							<td class="attributes">&lt;static&gt; &nbsp;</td>
							<td class="nameDescription">
								<div class="fixedFont">Karma.<b><a href="../symbols/Karma.html#.clone">clone</a></b>(target)
								</div>
								<div class="description">Returns a shallow copy of the passed in object</div>
							</td>
						</tr>
					
						<tr>
							<td class="attributes">&lt;static&gt; &nbsp;</td>
							<td class="nameDescription">
								<div class="fixedFont">Karma.<b><a href="../symbols/Karma.html#.copyObjectPlus">copyObjectPlus</a></b>(parent1, parent2)
								</div>
								<div class="description">Creates a new object that is a prototype of the first argument
then extends it with the properties of the second argument</div>
							</td>
						</tr>
					
						<tr>
							<td class="attributes">&lt;static&gt; &nbsp;</td>
							<td class="nameDescription">
								<div class="fixedFont">Karma.<b><a href="../symbols/Karma.html#.create">create</a></b>(parent)
								</div>
								<div class="description">This emulates the Object.create method in ecmascript 5 spec
This isn't a full implementation as it doesn't support an all of Object.create's features
This has the same functionality as Crockford's beget method
and this primary building block for prototypal inheritance in
this library</div>
							</td>
						</tr>
					
						<tr>
							<td class="attributes">&lt;static&gt; &nbsp;</td>
							<td class="nameDescription">
								<div class="fixedFont">Karma.<b><a href="../symbols/Karma.html#.objectPlus">objectPlus</a></b>(target, source)
								</div>
								<div class="description">Extends properties of the target object with those of 
the source object</div>
							</td>
						</tr>
					
					</tbody>
				</table>
				
				
				
			
<!-- ============================== events summary ======================== -->
			

<!-- ============================== constructor details ==================== -->		
			
			<div class="details"><a name="constructor"> </a>
				<div class="sectionTitle">
					Namespace Detail
				</div>
				
				<div class="fixedFont">
						<b>Karma</b>
				</div>
				
				<div class="description">
					Karma is the namespace for the Karma library and Karma() is the constructor 
function for the Karma library object Karma.karma. 
Karma() checks if the current document type is set to HTML 5, throws
an error if not. Otherwise, initializes the karma object and returns
a reference to that object.
					
				</div>
				
				
				
				<pre class="code">
var k = Karma({ 
                image: [ 
                   {name: "ninja", file: "ninja.png"}, 
                   {name: "cowboy", file: "cowboy.png"}
                        ],
                audio: [
                   {name: "woosh", file: "woosh.ogg"},
                   {name: "yeehaw", file: "yeehaw.ogg"}
                        ],
                video: [  //Not Yet Implemented
                   {name: "attack", file: "attack.ogv"},
                   {name: "ride", file: "ride.ogv"}
                        ]
                canvas: [
                   {name: "ninja", domId: "ninjaCanvas"},
                   {name: "cowboy", domId: "cowboyCanvas"}
                        ],
                svg: [ 
                   {name: "ninja", domId: "ninjaSvg"},
                   {name: "cowboy", domId: "cowboySvg"}
                        ],
                });
Next, call the ready function with a callback to your program code

k.ready(function () { ... your application code . . . }                       

after that you can access each asset like so
k.image.ninja;
k.svg.cowboy;
k.audio.yeehaw.play();
k.canvas.ninja.drawImage(k.image.ninja, 0, 0);</pre>
				
				
				
				
					
						<dl class="detailList">
						<dt class="heading">Parameters:</dt>
						
							<dt>
								<span class="light fixedFont">{Object}</span>  <b>options</b>
								<i>Optional, Default: {}</i>
							</dt>
								<dd>options for intializing Karma library</dd>
						
							<dt>
								<span class="light fixedFont">{String}</span>  <b>options.locale</b>
								<i>Optional, Default: ''</i>
							</dt>
								<dd>sets current locale Not Yet Implemented</dd>
						
							<dt>
								<span class="light fixedFont">{Array}</span>  <b>options.image</b>
								<i>Optional, Default: []</i>
							</dt>
								<dd>array of images to be converted into a collection</dd>
						
							<dt>
								<span class="light fixedFont">{Array}</span>  <b>options.audio</b>
								<i>Optional, Default: []</i>
							</dt>
								<dd>array of audio to be converted into a collection</dd>
						
							<dt>
								<span class="light fixedFont">{Array}</span>  <b>options.video</b>
								<i>Optional, Default: []</i>
							</dt>
								<dd>NYI array of videos to be converted into a collection</dd>
						
							<dt>
								<span class="light fixedFont">{Array}</span>  <b>options.svg</b>
								<i>Optional, Default: []</i>
							</dt>
								<dd>array of SVG elements to be 
converted into a collection. Each SVG element must already exist in the html document</dd>
						
							<dt>
								<span class="light fixedFont">{Array}</span>  <b>options.canvas</b>
								<i>Optional, Default: []</i>
							</dt>
								<dd>array of canvas elements 
to be converted into a collection. Each canvas element must already exist in the 
html document and width and height of each element must be set as attributes</dd>
						
						</dl>
					
					
					
					
						<dl class="detailList">
						<dt class="heading">Throws:</dt>
						
							<dt>
								<span class="light fixedFont">{Error}</span>  <b></b>
							</dt>
								<dd>if the document type declaration is not set to HTML 5, e.g. 
<!DOCTYPE html></dd>
						
							<dt>
								<span class="light fixedFont">{Error}</span>  <b></b>
							</dt>
								<dd>If any of the initialization parameters are invalid values</dd>
						
						</dl>
					
					
						<dl class="detailList">
						<dt class="heading">Returns:</dt>
						
								<dd><span class="light fixedFont">{Object}</span> Karma.karma -- reference to the initialized Karma library</dd>
						
						</dl>
					
					
					

			</div>
			

<!-- ============================== field details ========================== -->		
			

<!-- ============================== method details ========================= -->		
			
				<div class="sectionTitle">
					Method Detail
				</div>
				
					<a name=".clone"> </a>
					<div class="fixedFont">&lt;static&gt; 
					
					<span class="light">{Object}</span>
					<span class="light">Karma.</span><b>clone</b>(target)
					
					</div>
					<div class="description">
						Returns a shallow copy of the passed in object
						
						
					</div>
					
					
					
						
							<dl class="detailList">
							<dt class="heading">Parameters:</dt>
							
								<dt>
									<span class="light fixedFont">{Object}</span> <b>target</b>
									
								</dt>
								<dd>to be copied</dd>
							
							</dl>
						
						
						
						
						
							<dl class="detailList">
							<dt class="heading">Returns:</dt>
							
								<dd><span class="light fixedFont">{Object}</span> a shallow copy of target</dd>
							
							</dl>
						
						
						

					<hr />
				
					<a name=".copyObjectPlus"> </a>
					<div class="fixedFont">&lt;static&gt; 
					
					<span class="light">{Object}</span>
					<span class="light">Karma.</span><b>copyObjectPlus</b>(parent1, parent2)
					
					</div>
					<div class="description">
						Creates a new object that is a prototype of the first argument
then extends it with the properties of the second argument
						
						
					</div>
					
					
					
						
							<dl class="detailList">
							<dt class="heading">Parameters:</dt>
							
								<dt>
									<span class="light fixedFont">{Object}</span> <b>parent1</b>
									
								</dt>
								<dd>will be prototype of returned object</dd>
							
								<dt>
									<span class="light fixedFont">{Object}</span> <b>parent2</b>
									
								</dt>
								<dd>will extend properties of returned object</dd>
							
							</dl>
						
						
						
						
						
							<dl class="detailList">
							<dt class="heading">Returns:</dt>
							
								<dd><span class="light fixedFont">{Object}</span> object that whose prototype is parent1 and has 
been extended with properties of parent2</dd>
							
							</dl>
						
						
						

					<hr />
				
					<a name=".create"> </a>
					<div class="fixedFont">&lt;static&gt; 
					
					<span class="light">{Object}</span>
					<span class="light">Karma.</span><b>create</b>(parent)
					
					</div>
					<div class="description">
						This emulates the Object.create method in ecmascript 5 spec
This isn't a full implementation as it doesn't support an all of Object.create's features
This has the same functionality as Crockford's beget method
and this primary building block for prototypal inheritance in
this library
						
						
					</div>
					
					
					
					<pre class="code">
var ninja = { weapon : "sword" };
var ninja1 = Karma.create(ninja);
ninja1.weapon === "sword"</pre>
					
					
					
						
							<dl class="detailList">
							<dt class="heading">Parameters:</dt>
							
								<dt>
									<span class="light fixedFont">{Object}</span> <b>parent</b>
									
								</dt>
								<dd>that the new object's prototype should point to</dd>
							
							</dl>
						
						
						
						
						
							<dl class="detailList">
							<dt class="heading">Returns:</dt>
							
								<dd><span class="light fixedFont">{Object}</span> a new object whose prototype is parent</dd>
							
							</dl>
						
						
						

					<hr />
				
					<a name=".objectPlus"> </a>
					<div class="fixedFont">&lt;static&gt; 
					
					<span class="light">{Object}</span>
					<span class="light">Karma.</span><b>objectPlus</b>(target, source)
					
					</div>
					<div class="description">
						Extends properties of the target object with those of 
the source object
						
						
					</div>
					
					
					
						
							<dl class="detailList">
							<dt class="heading">Parameters:</dt>
							
								<dt>
									<span class="light fixedFont">{Object}</span> <b>target</b>
									
								</dt>
								<dd>object to be extended</dd>
							
								<dt>
									<span class="light fixedFont">{Object}</span> <b>source</b>
									
								</dt>
								<dd>whose properties will extend target</dd>
							
							</dl>
						
						
						
						
						
							<dl class="detailList">
							<dt class="heading">Returns:</dt>
							
								<dd><span class="light fixedFont">{Object}</span> target extended by source</dd>
							
							</dl>
						
						
						

					
				
			
			
<!-- ============================== event details ========================= -->		
			
			
			<hr />
		</div>

		
<!-- ============================== footer ================================= -->
		<div class="fineprint" style="clear:both">
			
			Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Sun Jan 03 2010 14:36:12 GMT+0545 (NPT)
		</div>
	</body>
</html>