Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Reminder($scope, SpeechService, $translate, Focus) {
const storage = require('electron-json-storage');
// Service variable
var remind = {};
// Flag to check if reminders list is empty
storage.empty = true;
// Need to use the callback function because when the service is initialize,
// the translation service is not set up.
$translate('reminders.empty').then(function (translation) {
remind.reminders = [translation];
});
// Check if reminder storage already exists
storage.has('sm-reminder', function (error, hasKey) {
if (error) throw error;
if (hasKey) {
// Flag to check if reminders list is empty
remind.empty = false;
storage.get('sm-reminder', function (error, data) {
if (error) throw error;
remind.reminders = data.reminders;
});
}