Viewing File: /usr/local/cpanel/base/frontend/jupiter/site-monitor/services/dataStore.js

/*
 * site-monitor/services/dataStore.js                   Copyright 2021 cPanel, L.L.C.
 *                                                           All rights reserved.
 * copyright@cpanel.net                                         http://cpanel.net
 * This code is subject to the cPanel license. Unauthorized copying is prohibited
 */

/* global define, PAGE */

/** @namespace cpanel.siteMonitor.services.dataStore */

define(
    [
        "angular"
    ],
    function(angular) {

        "use strict";

        var app = angular.module("cpanel.siteMonitor.dataStoreService", []);

        app.factory("dataStore", [
            "$window",
            function($window) {

                return {
                    save: function(action, data) {
                        $window.localStorage.setItem(action, angular.toJson(data));
                    },
                    get: function(action) {
                        var data = $window.localStorage.getItem(action);
                        return angular.fromJson(data);
                    },
                    remove: function(action) {
                        $window.localStorage.removeItem(action);
                    },
                    clear: function() {
                        $window.localStorage.clear();
                    }
                };
            }
        ]);
    }
);
Back to Directory File Manager