New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bpc.js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bpc.js - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

89

bpc.js

@@ -11,2 +11,3 @@ /**

var BPCStart = (function ModuleSpace() {
var frequency = (68.5 * 1e3) / 4;
/**

@@ -22,4 +23,18 @@ * the _getUndefined() function is used to avoid

function gxkSetInterval(cb) {
cb.apply(this, Array.prototype.slice.call(arguments, 2));
return setInterval.apply(this, arguments);
// cb.apply(this, Array.prototype.slice.call(arguments, 2));
// return setInterval.apply(this, arguments);
var timeoutHandle = 0;
function _process() {
if (timeoutHandle !== false) {
timeoutHandle = setTimeout(_process, 1e3 - Date.now() % 1e3);
cb();
}
}
_process();
return function() {
if (timeoutHandle !== false) {
clearTimeout(timeoutHandle);
timeoutHandle = false;
}
};
}

@@ -123,3 +138,3 @@ function toQuaternary(n, length) {

oscillator.type = 'square';
oscillator.frequency.setValueAtTime(13.7 * 1e3, audioCtx.currentTime);
oscillator.frequency.setValueAtTime(frequency, audioCtx.currentTime);
oscillator.connect(audioCtx.destination);

@@ -134,3 +149,3 @@ }

oscillator.type = 'square';
oscillator.frequency.setValueAtTime(13.7 * 1e3, audioCtx.currentTime);
oscillator.frequency.setValueAtTime(frequency, audioCtx.currentTime);
oscillator.connect(audioCtx.destination);

@@ -155,43 +170,41 @@ oscillator.start();

var framesSoundCode = [];
var intervalHandle = 0;
setTimeout(function() {
intervalHandle = gxkSetInterval(function() {
startAudioIfNeeded();
var soundSecond = framesSoundCode.shift();
if (soundSecond === _getUndefined()) {
var second = (new Date()).getSeconds();
var modeOfSecond = second % 20;
if (modeOfSecond === 0) {
frames = generateDateInfo(Date.now() + timeDifference);
var framesString = dateInfoTo4String(frames);
framesSoundCode = dateInfoStringToSoundCode(framesString);
cb({
frames: frames,
countdown: 0,
});
} else {
oscillator.stop(0.1);
oscillator = null;
cb({
frames: frames,
countdown: 20 - modeOfSecond,
});
}
} else {
oscillator.stop();
reinitAudio();
setTimeout(function() {
oscillator.start();
}, soundSecond * 1e3);
var intervalHandleStopFunction = gxkSetInterval(function() {
startAudioIfNeeded();
var soundSecond = framesSoundCode.shift();
if (soundSecond === _getUndefined()) {
var second = (new Date()).getSeconds();
var modeOfSecond = second % 20;
if (modeOfSecond === 0) {
frames = generateDateInfo(Date.now() + timeDifference);
var framesString = dateInfoTo4String(frames);
framesSoundCode = dateInfoStringToSoundCode(framesString);
cb({
frames: frames,
countdown: 0,
soundSecond: soundSecond,
});
} else {
oscillator.stop(0.1);
oscillator = null;
cb({
frames: frames,
countdown: 20 - modeOfSecond,
});
}
}, 1 * 1e3);
}, 1e3 - Date.now() % 1e3);
} else {
oscillator.stop();
reinitAudio();
setTimeout(function() {
oscillator.start();
}, soundSecond * 1e3);
cb({
frames: frames,
countdown: 0,
soundSecond: soundSecond,
});
}
});
stopFunction = function () {
isRunning = false;
clearInterval(intervalHandle);
intervalHandleStopFunction();
setTimeout(function() {

@@ -198,0 +211,0 @@ try {

{
"name": "bpc.js",
"version": "0.0.2",
"version": "0.0.3",
"description": "A JavaScript library used to generate 68.5KHz BPC which used for Radio controlled timepieces",

@@ -5,0 +5,0 @@ "main": "bpc.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc