Hello world
1. Clone repo
2. Create JS file with some code
3. Add the JS file to index.html
https://github.com/jan-os/janos
1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });
1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });
1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });
1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });
1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });
Bluetooth doorbell 1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });
Bluetooth doorbell 1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });
Bluetooth doorbell 1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });
Bluetooth doorbell 1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });