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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | "use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); var types_1 = require("./types"); var actionTypes = require("./actionTypes"); exports.actionTypes = actionTypes; var utils_1 = require("./utils"); function toEventObject(event // id?: TEvents['type'] ) { if (typeof event === 'string' || typeof event === 'number') { var eventObject = { type: event }; // if (id !== undefined) { // eventObject.id = id; // } return eventObject; } return event; } exports.toEventObject = toEventObject; function getActionFunction(actionType, actionFunctionMap) { if (!actionFunctionMap) { return undefined; } var actionReference = actionFunctionMap[actionType]; if (!actionReference) { return undefined; } if (typeof actionReference === 'function') { return actionReference; } return actionReference.exec; } exports.toActionObject = function (action, actionFunctionMap) { var actionObject; if (typeof action === 'string' || typeof action === 'number') { actionObject = { type: action, exec: getActionFunction(action, actionFunctionMap) }; } else if (typeof action === 'function') { actionObject = { type: action.name, exec: action }; } else { var exec = getActionFunction(action.type, actionFunctionMap); return exec ? __assign({}, action, { exec: exec }) : action; } Object.defineProperty(actionObject, 'toString', { value: function () { return actionObject.type; }, enumerable: false }); return actionObject; }; function toActivityDefinition(action) { var actionObject = exports.toActionObject(action); return __assign({ id: typeof action === 'string' ? action : actionObject.id }, actionObject, { type: actionObject.type }); } exports.toActivityDefinition = toActivityDefinition; exports.toActionObjects = function (action, actionFunctionMap) { if (!action) { return []; } var actions = Array.isArray(action) ? action : [action]; return actions.map(function (subAction) { return exports.toActionObject(subAction, actionFunctionMap); }); }; function raise(eventType) { return { type: actionTypes.raise, event: eventType }; } exports.raise = raise; function send(event, options) { return { target: options ? options.target : undefined, type: actionTypes.send, event: toEventObject(event), delay: options ? options.delay : undefined, id: options && options.id !== undefined ? options.id : utils_1.getEventType(event) }; } exports.send = send; function sendParent(event, options) { return send(event, __assign({}, options, { target: types_1.SpecialTargets.Parent })); } exports.sendParent = sendParent; function log(expr, label) { return { type: actionTypes.log, label: label, expr: expr }; } exports.log = log; exports.cancel = function (sendId) { return { type: actionTypes.cancel, sendId: sendId }; }; function start(activity) { var activityDef = toActivityDefinition(activity); return { type: types_1.ActionTypes.Start, activity: activityDef, exec: undefined }; } exports.start = start; function stop(activity) { var activityDef = toActivityDefinition(activity); return { type: types_1.ActionTypes.Stop, activity: activityDef, exec: undefined }; } exports.stop = stop; exports.assign = function (assignment) { return { type: actionTypes.assign, assignment: assignment }; }; function isActionObject(action) { return typeof action === 'object' && 'type' in action; } exports.isActionObject = isActionObject; function after(delay, id) { var idSuffix = id ? "#" + id : ''; return types_1.ActionTypes.After + "(" + delay + ")" + idSuffix; } exports.after = after; function done(id) { return types_1.ActionTypes.DoneState + "." + id; } exports.done = done; function invoke(invokeConfig, options) { if (typeof invokeConfig === 'string') { return __assign({ id: invokeConfig, src: invokeConfig, type: types_1.ActionTypes.Invoke }, options); } return invokeConfig; } exports.invoke = invoke; |