UNPKG

2.16 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.isLoadReducerCompleteAction = exports.isLoadReducerAction = exports.hostLoadCompleteReducer = exports.hostLoadReducer = exports.apiClientUnload = exports.apiClientLoad = exports.REDUCER_LOAD_COMPLETE = exports.REDUCER_LOAD = exports.API_CLIENT_UNLOAD = exports.API_CLIENT_LOAD = void 0;
4exports.API_CLIENT_LOAD = 'APICLIENT::LOAD';
5exports.API_CLIENT_UNLOAD = 'APICLIENT::UNLOAD';
6exports.REDUCER_LOAD = 'REDUCER::LOAD';
7exports.REDUCER_LOAD_COMPLETE = 'REDUCER::LOAD_COMPLETE';
8function apiClientLoad(payload) {
9 return {
10 payload: payload,
11 type: exports.API_CLIENT_LOAD,
12 };
13}
14exports.apiClientLoad = apiClientLoad;
15function apiClientUnload(payload) {
16 return {
17 payload: payload,
18 type: exports.API_CLIENT_UNLOAD,
19 };
20}
21exports.apiClientUnload = apiClientUnload;
22/**
23 * Creates an load reducer action
24 * @internal
25 */
26function hostLoadReducer(feature) {
27 return {
28 payload: {
29 feature: feature,
30 },
31 type: exports.REDUCER_LOAD,
32 };
33}
34exports.hostLoadReducer = hostLoadReducer;
35/**
36 * Creates an add reducer action
37 * @internal
38 */
39function hostLoadCompleteReducer(feature) {
40 return {
41 payload: {
42 feature: feature,
43 },
44 type: exports.REDUCER_LOAD_COMPLETE,
45 };
46}
47exports.hostLoadCompleteReducer = hostLoadCompleteReducer;
48/**
49 * Predicate to determine if an action is an load reducer action
50 * @internal
51 */
52function isLoadReducerAction(action) {
53 return (action instanceof Object &&
54 action.type === exports.REDUCER_LOAD &&
55 action.payload &&
56 typeof action.payload.feature === 'string');
57}
58exports.isLoadReducerAction = isLoadReducerAction;
59/**
60 * Predicate to determine if an action is an load reducer complete action
61 * @internal
62 */
63function isLoadReducerCompleteAction(action) {
64 return (action instanceof Object &&
65 action.type === exports.REDUCER_LOAD_COMPLETE &&
66 action.payload &&
67 typeof action.payload.feature === 'string');
68}
69exports.isLoadReducerCompleteAction = isLoadReducerCompleteAction;