sforkowany z mirror/soapbox
Developers: become a developer through the console
rodzic
0e3d27a91e
commit
860f8c3b93
|
@ -25,6 +25,7 @@ import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
|||
import { generateThemeCss } from 'soapbox/utils/theme';
|
||||
import messages from 'soapbox/locales/messages';
|
||||
import { FE_SUBDIRECTORY } from 'soapbox/build_config';
|
||||
import { createGlobals } from 'soapbox/globals';
|
||||
|
||||
const validLocale = locale => Object.keys(messages).includes(locale);
|
||||
|
||||
|
@ -33,6 +34,9 @@ const previewVideoState = 'previewVideoModal';
|
|||
|
||||
export const store = configureStore();
|
||||
|
||||
// Configure global functions for developers
|
||||
createGlobals(store);
|
||||
|
||||
store.dispatch(preload());
|
||||
|
||||
store.dispatch(fetchMe())
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* globals: do things through the console.
|
||||
* This feature is for developers.
|
||||
*/
|
||||
import { changeSetting } from 'soapbox/actions/settings';
|
||||
|
||||
export const createGlobals = store => {
|
||||
const Soapbox = {
|
||||
// Become a developer with `Soapbox.isDeveloper()`
|
||||
isDeveloper: (bool = true) => {
|
||||
if (![true, false].includes(bool)) {
|
||||
throw `Invalid option ${bool}. Must be true or false.`;
|
||||
}
|
||||
store.dispatch(changeSetting(['isDeveloper'], bool));
|
||||
return bool;
|
||||
},
|
||||
};
|
||||
|
||||
window.Soapbox = Soapbox;
|
||||
};
|
Ładowanie…
Reference in New Issue