Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
e9cdc38f
Commit
e9cdc38f
authored
Mar 26, 2022
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing types to viewer store module
parent
7c13e7ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
viewer.js
src/sidebar/store/modules/viewer.js
+10
-11
No files found.
src/sidebar/store/modules/viewer.js
View file @
e9cdc38f
import
*
as
util
from
'../util'
;
import
{
createStoreModule
}
from
'../create-store'
;
import
{
createStoreModule
,
makeAction
}
from
'../create-store'
;
/**
* This module defines actions and state related to the display mode of the
...
...
@@ -15,8 +13,14 @@ const initialState = {
sidebarHasOpened
:
false
,
};
/** @typedef {typeof initialState} State */
const
reducers
=
{
SET_SIDEBAR_OPENED
:
(
state
,
action
)
=>
{
/**
* @param {State} state
* @param {{ opened: boolean }} action
*/
SET_SIDEBAR_OPENED
(
state
,
action
)
{
if
(
action
.
opened
===
true
)
{
// If the sidebar is open, track that it has ever been opened
return
{
sidebarHasOpened
:
true
};
...
...
@@ -26,19 +30,14 @@ const reducers = {
},
};
const
actions
=
util
.
actionTypes
(
reducers
);
// Action creators
/**
* @param {boolean} opened - If the sidebar is open
*/
function
setSidebarOpened
(
opened
)
{
return
{
type
:
actions
.
SET_SIDEBAR_OPENED
,
opened
}
;
return
makeAction
(
reducers
,
'SET_SIDEBAR_OPENED'
,
{
opened
})
;
}
// Selectors
/** @param {State} state */
function
hasSidebarOpened
(
state
)
{
return
state
.
sidebarHasOpened
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment