diff options
| author | Gubolin <gubolin@fantasymail.de> | 2014-09-06 15:52:50 +0200 |
|---|---|---|
| committer | Gubolin <gubolin@fantasymail.de> | 2014-09-06 15:52:50 +0200 |
| commit | 5bd357806fb0f3d0a9556dfb718f53bfb6af4fbb (patch) | |
| tree | 4d1739bc77a715d62eae4f813dfb732bbf4593a4 | |
| parent | 23664e86b4e92c74d7ed64152b66709e5b2e5253 (diff) | |
| download | snap-5bd357806fb0f3d0a9556dfb718f53bfb6af4fbb.tar.gz snap-5bd357806fb0f3d0a9556dfb718f53bfb6af4fbb.zip | |
add vibrate block
| -rwxr-xr-x | mobile.sh | 1 | ||||
| -rw-r--r-- | objects.js | 7 | ||||
| -rw-r--r-- | threads.js | 6 |
3 files changed, 14 insertions, 0 deletions
@@ -13,4 +13,5 @@ git clone https://github.com/Gubolin/snap.git www cd www git checkout mobileapp cordova platform add android +cordova plugin add org.apache.cordova.vibration cordova build android @@ -878,6 +878,11 @@ SpriteMorph.prototype.initBlocks = function () { category: 'sensing', spec: 'current %dates' }, + doVibrate: { + type: 'command', + category: 'sensing', + spec: 'vibrate %n seconds' + }, // Operators reifyScript: { @@ -4991,6 +4996,8 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push(block('doSetFastTracking')); blocks.push('-'); blocks.push(block('reportDate')); + blocks.push('-'); + blocks.push(block('doVibrate')); // for debugging: /////////////// @@ -2601,6 +2601,12 @@ Process.prototype.reportDate = function (datefn) { return result; }; +Process.prototype.doVibrate = function (seconds) { + if ("vibrate" in navigator) { + window.navigator.vibrate(seconds * 1000); + } +}; + // Process code mapping /* |
