Skip to content

Commit 541696e

Browse files
author
Adrian
committed
Merge branch 'master' of https://github.com/greathansen/Summit
2 parents e9c5b4d + dcbc060 commit 541696e

File tree

3 files changed

+143
-3
lines changed

3 files changed

+143
-3
lines changed

Images/geeknpoke-concurrency.png

7.6 KB
Loading

Views/Summit.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ <h1>HTML5 Elements</h1>
7171
<h1>CSS3</h1>
7272
<h1>JavaScript API</h1>
7373
<h2>Connectivity: webworkers, websockets</h2>
74-
<h2>Snippets: geolocation, fileaccess, storage</h2>
7574
<h1>Hey, Ho, Let's code</h1>
7675
</center>
7776
</body>

Views/WhatIsNew.html

Lines changed: 143 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,147 @@ <h1>What's New</h1>
389389
p {
390390
font-family: DeliciousRoman, Helvetica, Arial, sans-serif;
391391
}
392+
</pre>
393+
</section>
394+
395+
<section>
396+
<div class="centerTitle">Java Script API</div>
397+
<h3 style="text-align: right;">
398+
JavaScript API</h3>
399+
<div></br>
400+
<ul>
401+
<li>A lot of new features to have native implementation were added</li>
402+
<li>File API to have native drag and drop, desktop drag in</li>
403+
<li>FileSystem API allows to create, delete and save files in the user machine.</li>
404+
<li>Web SQL Storage</li>
405+
<li>IndexDB</li>
406+
<li>Web Storage</li>
407+
<li>Aplication Cache</li>
408+
<li>WebWorkers</li>
409+
<li>WebSockets</li>
410+
</ul>
411+
</div>
412+
</section>
413+
414+
<section>
415+
<h2>Storage</h2>
416+
<h3 style="text-align: right;">
417+
JavaScript API</h3>
418+
</br><ul>
419+
<li>With html5 and the javascript API allow save data on the client device usign different strategies.</li>
420+
</br><h2>Web SQL Dabase</h2>
421+
<li><br>We can create a structured data base in the client device</li>
422+
</ul></br>
423+
<pre class="prettyprint">
424+
var db = window.openDatabase("DBName", "1.0", "description",
425+
5*1024*1024); //5MB
426+
db.transaction(function(tx) {
427+
tx.executeSql("SELECT * FROM test", [], successCallback, errorCallback);
428+
});</pre>
429+
430+
</section>
431+
<section>
432+
<h2>Index DB</h2>
433+
<h3 style="text-align: right;">
434+
JavaScript API</h3>
435+
<ul>
436+
<li>We have a key value, so we don't have to iterate for each item</ul>
437+
</br>
438+
<pre class="prettyprint">
439+
var idbRequest = window.indexedDB.open('DatabaseName');
440+
idbRequest.onsuccess = function(event) {
441+
var db = event.srcElement.result;
442+
var transaction = db.transaction([], IDBTransaction.READ_ONLY);
443+
var curRequest =
444+
transaction.objectStore('ObjectStoreName').openCursor();
445+
curRequest.onsuccess = ...;
446+
};</pre>
447+
</section>
448+
449+
<section>
450+
<h2>Web Storage</h2>
451+
<h3 style="text-align: right;">
452+
JavaScript API</h3>
453+
<ul>
454+
<li>It's a key value mapping, so we don't have to iterate for each item</li>
455+
<li>The key value support only string-to-string mapping</li>
456+
</ul></br>
457+
<pre class="prettyprint">
458+
sessionStorage.MFUserName = 'Summit';
459+
//or
460+
window.localStorage.setItem('MFUserName', 'Summit');
461+
return true;
462+
</pre>
463+
</section>
464+
465+
<section>
466+
<h2>Application Cache</h2>
467+
<h3 style="text-align: right;">
468+
JavaScript API</h3>
469+
<ul>
470+
<li>It's a key value mapping, so we don't have to iterate for each item</li>
471+
<li>The key value support only string-to-string mapping</li>
472+
</ul></br>
473+
<pre class="prettyprint">
474+
<span class="tag">&lt;html manifest="cache.appcache"></span>
475+
window.applicationCache.addEventListener('updateready', function(e) {
476+
if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
477+
window.applicationCache.swapCache();
478+
if (confirm('A new version of this site is available. Load it?')) {
479+
window.location.reload();
480+
}
481+
}
482+
}, false);
483+
</pre>
484+
</section>
485+
486+
487+
<section>
488+
<h2>File API</h2>
489+
<h3 style="text-align: right;">
490+
JavaScript API</h3>
491+
<ul>
492+
<li>This API allows create, delete, open files in the user device</li>
493+
<li>We can create folders</li>
494+
</ul></br>
495+
<pre class="prettyprint">
496+
window.requestFileSystem(window.TEMPORARY, 1024 * 1024, function(fs) {
497+
// fs.root is a DirectoryEntry object.
498+
fs.root.getFile('log.txt', {create: true}, function(fileEntry) {
499+
fileEntry.createWriter(function(writer) {
500+
// writer is a FileWriter object.
501+
writer.onwrite = function(e) { ... };
502+
writer.onerror = function(e) { ... };
503+
var bb = new BlobBuilder();
504+
bb.append('Hello World!');
505+
writer.write(bb.getBlob('text/plain'));
506+
}, opt_errorHandler); }
507+
}, opt_errorHandler);
508+
</pre>
509+
</section>
510+
511+
<section>
512+
<h2>File API</h2>
513+
<h3 style="text-align: right;">
514+
JavaScript API</h3>
515+
<ul>
516+
<li>We have native drag and drop functionallity</li>
517+
</ul></br>
518+
<pre class="prettyprint">
519+
(function() {
520+
var files = document.querySelectorAll('a.dragout');
521+
for (var i = 0, file; file = files[i]; ++i) {
522+
file.addEventListener('dragstart', function(e) {
523+
var strippedUrl = document.location.toString().split("Views");
524+
var href = this.getAttribute('href');
525+
var dataDownloadUrl = 'audio/mpeg:' + href.substring(9, href.length).
526+
replace(' ', '%20') + ':' + strippedUrl[0].toString() +
527+
href.substring(3, href.length).replace('\\','/').replace(' ', '%20');
528+
e.dataTransfer.setData('DownloadURL', dataDownloadUrl);
529+
}, false);
530+
}
531+
})();
532+
392533
</pre>
393534
</section>
394535

@@ -401,8 +542,8 @@ <h1>What's New</h1>
401542
<section>
402543
<h3 style="text-align: right;">
403544
JavaScript API - Web Workers</h3>
404-
<h1>
405-
The concurrency problem</h1>
545+
<h2>
546+
The concurrency problem</h2>
406547
<div>
407548
<div>
408549
<img src="../Images/geeknpoke-concurrency.png" alt="Concurrency comic" />

0 commit comments

Comments
 (0)