UNPKG

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