All files / ext.wikilambda.edit/store actions.js

83.33% Statements 5/6
100% Branches 0/0
50% Functions 1/2
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44                13x   13x                 12x                                 12x 12x            
/*!
 * WikiLambda Vue editor: Application store actions
 *
 * @copyright 2020– Abstract Wikipedia team; see AUTHORS.txt
 * @license MIT
 */
'use strict';
 
var Constants = require( '../Constants.js' );
 
module.exports = exports = {
	/**
	 * Fetch information of the Keys used within the UI and initialize the i18n plugin
	 *
	 * @param {Object} context
	 * @param {Function} i18n - i18n function
	 */
	initialize: function ( context, i18n ) {
		// Pre-fetch a list of the most common Zids
		const zids = [
			Constants.Z_OBJECT,
			Constants.Z_PERSISTENTOBJECT,
			Constants.Z_MULTILINGUALSTRING,
			Constants.Z_KEY,
			Constants.Z_TYPE,
			Constants.Z_STRING,
			Constants.Z_FUNCTION,
			Constants.Z_FUNCTION_CALL,
			Constants.Z_REFERENCE,
			Constants.Z_BOOLEAN,
			Constants.Z_BOOLEAN_TRUE,
			Constants.Z_BOOLEAN_FALSE,
			Constants.Z_IMPLEMENTATION,
			context.getters.getUserZlangZID,
			Constants.Z_TYPED_LIST
		];
		context.dispatch( 'fetchZKeys', { zids: zids } );
		context.commit( 'setI18n', i18n );
	},
	toggleExpertMode: function ( context ) {
		context.commit( 'setExpertMode', !context.getters.isExpertMode );
	}
};