以下の記事を参考にして、プラグインを追加しましたがうまく動作しません。
http://apoc.jp/cordova-plugin-use/
www/js/index.jsの中身
Javascript
1var app = { 2 // Application Constructor 3 initialize: function() { 4 document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); 5 }, 6 7 // deviceready Event Handler 8 // 9 // Bind any cordova events here. Common events are: 10 // 'pause', 'resume', etc. 11 onDeviceReady: function() { 12 navigator.vibrate(1000); 13 }, 14 15 // Update DOM on a Received Event 16 receivedEvent: function(id) { 17 var parentElement = document.getElementById(id); 18 var listeningElement = parentElement.querySelector('.listening'); 19 var receivedElement = parentElement.querySelector('.received'); 20 21 listeningElement.setAttribute('style', 'display:none;'); 22 receivedElement.setAttribute('style', 'display:block;'); 23 console.log('Received Event: ' + id); 24}; 25 26app.initialize();
何か間違っている箇所はありますでしょうか?
あなたの回答
tips
プレビュー