blob: 76cb9beba512eb78fee2395547a0c8b34a063e24 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Utility functions for the App Management page.
*/
cr.define('app_management.util', function() {
/**
* @return {!AppManagementPageState}
*/
function createEmptyState() {
return {
apps: {},
currentPage: {
pageType: PageType.MAIN,
selectedAppId: null,
}
};
}
/**
* @param {!Array<App>} apps
* @return {!AppManagementPageState}
*/
function createInitialState(apps) {
const initialState = createEmptyState();
for (const app of apps) {
initialState.apps[app.id] = app;
}
return initialState;
}
return {
createEmptyState: createEmptyState,
createInitialState: createInitialState,
};
});