Commit ce6352d8 authored by Muhammadali's avatar Muhammadali

update-

parent 11794594
{ {
"name": "boxdialer", "name": "boxdialer",
"version": "4.1.8", "version": "4.1.9",
"description": "", "description": "",
"main": "src/boxDialer.js", "main": "src/boxDialer.js",
"scripts": { "scripts": {
......
...@@ -178,37 +178,38 @@ const ModalPhoneNumpad = ({ ...@@ -178,37 +178,38 @@ const ModalPhoneNumpad = ({
'*': [941.0, 1209.0], '*': [941.0, 1209.0],
'#': [941.0, 1477.0], '#': [941.0, 1477.0],
}; };
useEffect(() => {
document.addEventListener('keydown', (e) => {
// if (a[e?.key][0] && a[e?.key][1]) {
// boxDialer.dialTone(a[e.key][0], a[e.key][1]);
// }
handleKeyUp(e);
});
return () => {
document.removeEventListener('keydown', handleKeyUp);
};
}, [handleKeyUp]);
// useEffect(() => { // useEffect(() => {
// document.addEventListener('keyup', (e) => {
// if (e.repeat) return;
// else {
// boxDialer.stop();
// console.log('key up');
// }
// });
// document.addEventListener('keydown', (e) => { // document.addEventListener('keydown', (e) => {
// if (e.repeat) return; // if (a[e?.key][0] && a[e?.key][1]) {
// else if (a[e.key] && a[e.key][0] ? a[e.key][0] : false) {
// if (a[e.key][0] && a[e.key][1]) { // if (e.repeat) {
// boxDialer.dialTone(a[e.key][0], a[e.key][1]); // return;
// console.log('key down'); // } else {
// handleKeyUp(e);
// if (a[e.key] && a[e.key][0] ? a[e.key][0] : false) {
// if (a[e.key][0] && a[e.key][1]) {
// document.addEventListener('keyup', (e) => {
// // if (e.repeat) return;
// boxDialer.stop();
// console.log('key up');
// });
// boxDialer.dialTone(a[e.key][0], a[e.key][1]);
// console.log('key down');
// }
// }
// } // }
// } // }
// }); // });
// }, []);
// return () => {
// document.removeEventListener('keydown', handleKeyUp);
// };
// }, [handleKeyUp]);
// document.addEventListener('keydown', (e) => {
// console.log('key down all (' + e.repeat + ')');
// });
// useEffect(()=>) // useEffect(()=>)
// `${Data.getHours()}:${Data.getMinutes()} ${Data.getDate()}.${Data.getMonth()+1}.${Data.getFullYear()}` // `${Data.getHours()}:${Data.getMinutes()} ${Data.getDate()}.${Data.getMonth()+1}.${Data.getFullYear()}`
const callButton = () => { const callButton = () => {
......
...@@ -100,6 +100,12 @@ export class BoxDialer { ...@@ -100,6 +100,12 @@ export class BoxDialer {
dialTone(freq1, freq2) { dialTone(freq1, freq2) {
// merger = context.createChannelMerger(2); // merger = context.createChannelMerger(2);
setTimeout(() => {
console.log('-= sTOPING BY TIMEOUT');
this.stop();
}, 1000);
if (this.oscillator1 || this.oscillator2) return;
console.log('Begin dialTone:', this.oscillator1, this.oscillator2);
this.oscillator1 = this.musicContext.createOscillator(); this.oscillator1 = this.musicContext.createOscillator();
// this.oscillator1.type = null; // this.oscillator1.type = null;
...@@ -130,8 +136,6 @@ export class BoxDialer { ...@@ -130,8 +136,6 @@ export class BoxDialer {
this.oscillator2.start this.oscillator2.start
? this.oscillator2.start(0) ? this.oscillator2.start(0)
: this.oscillator2.noteOn(0); : this.oscillator2.noteOn(0);
// merger.connect(context.destination);
} }
start() { start() {
if (typeof this.oscillator1 != 'undefined') this.oscillator1.disconnect(); if (typeof this.oscillator1 != 'undefined') this.oscillator1.disconnect();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment