This commit is contained in:
syuilo
2018-10-19 14:34:51 +09:00
parent b622946844
commit e8de29ae79
5 changed files with 32 additions and 41 deletions

View File

@@ -5,6 +5,7 @@ import * as nestedProperty from 'nested-property';
import MiOS from './mios';
import { hostname } from './config';
import { erase } from '../../prelude/array';
import getNoteSummary from '../../misc/get-note-summary';
const defaultSettings = {
home: null,
@@ -73,7 +74,8 @@ export default (os: MiOS) => new Vuex.Store({
i: null,
indicate: false,
uiHeaderHeight: 0,
navHook: null
navHook: null,
behindNotes: []
},
getters: {
@@ -99,6 +101,18 @@ export default (os: MiOS) => new Vuex.Store({
navHook(state, callback) {
state.navHook = callback;
},
pushBehindNote(state, note) {
if (note.userId === state.i.id) return;
if (state.behindNotes.some(n => n.id === note.id)) return;
state.behindNotes.push(note);
document.title = `(${state.behindNotes.length}) ${getNoteSummary(note)}`;
},
clearBehindNotes(state) {
state.behindNotes = [];
document.title = os.instanceName;
}
},