This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* SystemJS hook that caches load and transpilation results of sources that haven't changed in IndexedDB storage. | |
* In Chrome dev tools the cache is easily managed under Resources > IndexedDB > jspm | |
* There's a global dependency on Dexie.js (ex: //npmcdn.com/[email protected]/dist/dexie.min.js) | |
* Add the following to your index.ghtml <script src="http://npmcdn.com/[email protected]/dist/dexie.min.js"></script> | |
* Adapted from https://gist.github.com/ineentho/70303c2ccdb69ad3661d | |
*/ | |
;(function(){ | |
var db = new Dexie("jspm"); | |
db.version(1).stores({ files: "&url,format,hash,contents" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A diff utility that compares arrays and returns a list of added, removed, and updated items | |
* | |
* Returns an object with two methods: | |
* diff: do a one-time diff of two arrays | |
* watch: observe a variable on scope and report any changes to a callback | |
* | |
* Invoking the factory is done like so: | |
* <code> | |
* function(listDiff) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['angular'], function(angular) { | |
// add a few helpers | |
Array.prototype.union = function(a){ | |
var r = this.slice(0); | |
a.forEach(function(i) { if (r.indexOf(i) < 0) r.push(i); }); | |
return r; | |
}; | |
Array.prototype.diff = function(a){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Web Workers</title> | |
</head> | |
<body> | |
<script id="worker" type="app/worker"> | |
addEventListener('message', function() { | |
postMessage('What up, sucka.'); |