forked from FINAKON/HelpProject
1. Initial Commit - a boiler plate code and POC to realize the concept of context sensitive help 2. Frontend code written in ReactJS 3. Backend code written in Java, Spring Boot Framework 4. Frontend Start: pre-requisites : node, npm npm run dev ==> to start the frontend vite server 5. Backend Start: pre-requisites : java, mvn mvn spring-boot:run ==> to start the backend server 6. Visit http://localhost:5173/ for basic demo of help, press F1 in textboxes 7. Visit http://localhost:5173/editor and enter "admin123" to add/modify texts. Happy Coding !!! Thank you, Bhargava.
58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.build = void 0;
|
|
const onlyCountsSync = (state) => {
|
|
return state.counts;
|
|
};
|
|
const groupsSync = (state) => {
|
|
return state.groups;
|
|
};
|
|
const defaultSync = (state) => {
|
|
return state.paths;
|
|
};
|
|
const limitFilesSync = (state) => {
|
|
return state.paths.slice(0, state.options.maxFiles);
|
|
};
|
|
const onlyCountsAsync = (state, error, callback) => {
|
|
report(error, callback, state.counts, state.options.suppressErrors);
|
|
return null;
|
|
};
|
|
const defaultAsync = (state, error, callback) => {
|
|
report(error, callback, state.paths, state.options.suppressErrors);
|
|
return null;
|
|
};
|
|
const limitFilesAsync = (state, error, callback) => {
|
|
report(error, callback, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
|
|
return null;
|
|
};
|
|
const groupsAsync = (state, error, callback) => {
|
|
report(error, callback, state.groups, state.options.suppressErrors);
|
|
return null;
|
|
};
|
|
function report(error, callback, output, suppressErrors) {
|
|
if (error && !suppressErrors)
|
|
callback(error, output);
|
|
else
|
|
callback(null, output);
|
|
}
|
|
function build(options, isSynchronous) {
|
|
const { onlyCounts, group, maxFiles } = options;
|
|
if (onlyCounts)
|
|
return isSynchronous
|
|
? onlyCountsSync
|
|
: onlyCountsAsync;
|
|
else if (group)
|
|
return isSynchronous
|
|
? groupsSync
|
|
: groupsAsync;
|
|
else if (maxFiles)
|
|
return isSynchronous
|
|
? limitFilesSync
|
|
: limitFilesAsync;
|
|
else
|
|
return isSynchronous
|
|
? defaultSync
|
|
: defaultAsync;
|
|
}
|
|
exports.build = build;
|