loop-modules
Version:
Shared modules for the Loop product suite.
40 lines (39 loc) • 1.22 kB
JavaScript
import { type } from '../utils/type';
var CATEGORY = 'LoopAssignment';
export var ActionTypes = {
QUERY: type("[" + CATEGORY + "] Query"),
SET_ENTRIES: type("[" + CATEGORY + "] Set Entries"),
UNREAD: type("[" + CATEGORY + "] Unread")
};
/**
* Every action is comprised of at least a type and an optional
* payload. Expressing actions as classes enables powerful
* type checking in reducer functions.
*
* See Discriminated Unions: https://www.typescriptlang.org/docs/handbook/advanced-types.html#discriminated-unions
*/
var QueryAction = (function () {
function QueryAction(payload) {
this.payload = payload;
this.type = ActionTypes.QUERY;
}
return QueryAction;
}());
export { QueryAction };
var SetEntriesAction = (function () {
function SetEntriesAction(payload) {
if (payload === void 0) { payload = []; }
this.payload = payload;
this.type = ActionTypes.SET_ENTRIES;
}
return SetEntriesAction;
}());
export { SetEntriesAction };
var UnreadAction = (function () {
function UnreadAction(payload) {
this.payload = payload;
this.type = ActionTypes.UNREAD;
}
return UnreadAction;
}());
export { UnreadAction };