PageSourceSearch

https://reasonator.toolforge.org/v2/state.js

js reasonator.toolforge.org collected 2026-10-10 02:21:01 UTC 1,036 bytes, 38 lines download raw bytes

1/**
2 * App-level reactive state for Reasonator V2.
3 *
4 * The shared `state` from vue_es6 (wd, widar, tt) is re-exported.
5 * Our own slots (`config`, `configLoaded`) live on a separate observable so
6 * we don't mutate the imported library object.
7 */
8
9import {
10    state, setWd, setWidar, setTt, setWikidataApiUrl,
11} from '../resources/vue_es6/state.js';
12
13const _appRaw = {
14    config: {},
15    configLoaded: false,
16    siteInfo: null,
17    // Bumped whenever a label is saved, so links rendered before the edit
18    // can pick up the new text without a page reload.
19    labelEdits: 0,
20};
21
22export const appState = (typeof Vue !== 'undefined') ? Vue.observable(_appRaw) : _appRaw;
23
24export function setConfig(cfg) {
25    appState.config = cfg;
26    appState.configLoaded = true;
27}
28
29export function setSiteInfo(info) {
30    appState.siteInfo = info;
31}
32
33/** Announce that a label was saved; see `appState.labelEdits`. */
34export function noteLabelEdit() {
35    appState.labelEdits++;
36}
37
38export { state, setWd, setWidar, setTt, setWikidataApiUrl };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.