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
var onsuccess = function(){ | |
console.log('now the store is clean again!'); | |
} | |
var onerror = function(error){ | |
console.log('Oh noes, sth went wrong!', error); | |
} | |
customers.clear(onsuccess, onerror); |
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
// modify this: | |
} else if ( object instanceof THREE.Mesh ) { | |
// to: | |
} else if ( object.matrixWorld && object.geometry ) { |
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
onModelLoaded: function(collada){ | |
var object = collada.scene; | |
// some stuff here | |
var mesh = object.children.filter(function(child){ | |
return child instanceof THREE.Mesh; | |
})[0]; | |
object.geometry = mesh.geometry; |
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
/** | |
* [Forked from https://gist.github.com/2651899] | |
* | |
* A console.assert which actually stop the exectution. | |
* default console.assert() is a plain display, such as console.log() or console.error(); | |
* It doesnt stop the execution like assert() is meant to do. This is a little code to | |
* "workaround this limitation" :) | |
* | |
* Usage: | |
* console.assert(foo === bar); // Will throw if not equal |
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
function(scene, options){ | |
var opts = tools.mixin({ | |
folder: 'textures/skybox/default/', | |
filetype: 'png', | |
size: 1000000 | |
}, options || {}); | |
var urls = []; | |
['x','y','z'].forEach(function(axis){ |
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
container.addEventListener('click', function (evt) { | |
// The user has clicked; let's note this event | |
// and the click's coordinates so that we can | |
// react to it in the render loop | |
clickInfo.userHasClicked = true; | |
clickInfo.x = evt.clientX; | |
clickInfo.y = evt.clientY; | |
}, false); |
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
customers.iterate(onItem, { | |
index: 'lastname', | |
keyRange: myKeyRange, | |
order: 'ASC', | |
filterDuplicates: false, | |
writeAccess: false, | |
onEnd: onEndCallback, | |
onError: onErrorCallback | |
}); |
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
var onItem = function (item) { | |
console.log('got item:', item); | |
}; | |
var onEnd = function (item) { | |
console.log('All done.'); | |
}; | |
customers.iterate(onItem, { | |
order: 'DESC', | |
onEnd: onEnd |
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
/** | |
* Takes an array of data objects to store and calls IDBWrapper's batch() method | |
* | |
* @param {Array} dataArray An array of objects to be stored | |
* @param {Function} [onSuccess] Gets called if the operation was successful | |
* @param {onError} [onError] Gets called if an error occurred | |
*/ | |
function putMany (dataArray, onSuccess, onError) { | |
var preparedData = dataArray.map(function(dataObject){ |
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
var SPEECH = 'speech'; | |
var bindings = { | |
/* ... */ | |
fullSpeed: { | |
device: SPEECH, | |
inputId: 'full speed' | |
}, | |
stop: { |