Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@caseywebb/growhaus-agent

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@caseywebb/growhaus-agent - npm Package Compare versions

Comparing version 0.0.0-latest.20190729T211711Z.f921b60 to 0.0.0-latest.20190729T215824Z.49036fa

bin/growhaus-agent

17

dist/index.js

@@ -13,6 +13,17 @@ "use strict";

const offlineFallbackSchedule = new schedule_1.LightSchedule();
process.on('SIGINT', () => {
console.log('Exiting...');
let forceQuit = false;
const quit = () => {
if (forceQuit) {
process.exit();
}
else {
forceQuit = true;
}
console.log('Exiting... (Press ctrl+c again to force exit)');
driver.setBrightness(100);
});
socket.dispose();
offlineFallbackSchedule.dispose();
process.off('SIGINT', quit);
};
process.on('SIGINT', quit);
socket.on(socket_1.IncomingEvent.Brightness, (m) => {

@@ -19,0 +30,0 @@ // pause until 10 minutes after we should have received a new message

6

dist/schedule.d.ts
export declare class LightSchedule {
private paused;
private pauseTimeout?;
private subscriptions;
private schedule;
private readonly updateInterval;
private readonly subscriptions;
private readonly schedule;
constructor();
pause(duration: number): void;
subscribe(handler: (b: number) => void): void;
dispose(): void;
private getCurrentBrightness;

@@ -10,0 +12,0 @@ private next;

@@ -36,3 +36,3 @@ "use strict";

];
setInterval(this.next, 60 * 1000 * 60);
this.updateInterval = setInterval(this.next, 60 * 1000 * 60);
}

@@ -54,2 +54,9 @@ pause(duration) {

}
dispose() {
console.log('Disposing offline schedule...');
if (this.pauseTimeout)
clearTimeout(this.pauseTimeout);
clearInterval(this.updateInterval);
console.log('Offline schedule disposed.');
}
getCurrentBrightness() {

@@ -56,0 +63,0 @@ return this.schedule[new Date().getHours()];

@@ -19,2 +19,3 @@ export declare enum IncomingEvent {

on(eventType: IncomingEvent.Brightness, handler: (m: ManualBrightnessMessage) => void): void;
dispose(): void;
private connect;

@@ -21,0 +22,0 @@ private wsHeartbeat;

@@ -24,2 +24,10 @@ "use strict";

}
dispose() {
console.log('Disposing socket connection...');
if (this.heartbeatTimeout)
clearTimeout(this.heartbeatTimeout);
this.ws.off('close', this.wsClose);
this.ws.close();
console.log('Socket connection disposed.');
}
connect() {

@@ -57,3 +65,8 @@ console.log(`Attempting to connect to ${this.url}...`);

const handlers = this.onMessageHandlers[message.event];
await Promise.all(handlers.map((h) => h(message)));
if (!handlers) {
console.error('Received unknown message:', JSON.stringify(message, null, 2));
}
else {
await Promise.all(handlers.map((h) => h(message)));
}
}

@@ -60,0 +73,0 @@ }

{
"name": "@caseywebb/growhaus-agent",
"version": "0.0.0-latest.20190729T211711Z.f921b60",
"version": "0.0.0-latest.20190729T215824Z.49036fa",
"author": "Casey Webb (https://caseyWebb.xyz)",

@@ -20,3 +20,2 @@ "bin": {

"dependencies": {
"@caseywebb/growhaus": "^0.0.0-f921b608fb082a224d1999d91a4b7c0cf5ca54ba.20190729T211711Z.f921b60",
"autobind-decorator": "^2.4.0",

@@ -23,0 +22,0 @@ "dotenv": "^8.0.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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