Skip to content

Instantly share code, notes, and snippets.

courses:{
1:{
lastUpdated: '',
id: 1,
courseTitle: 'course title 1',
active: true,
chapters: [1]
},
2:{
lastUpdated: '',
// SignInForm.js
import React from 'react';
var Input = require('./FormElements/Input');
var SignInForm =() => ( <Input />);
export default SignInForm;
// Input.js
co(function*() {
while (true) {
var value = yield this.queue.next();
var isIdempotent = yield this.workflow.checkIdempotency(value.event, this.handlerName);
var eventHandled = isIdempotent === true ? yield this.workflow.wrapHandlerFunction(value.event,value.handlerFunction):'';
var recordEventProcessed = isIdempotent === true ? yield this.workflow.recordEventProcessed(value.event, this.handlerName):'';
}
}.bind(this)).catch(function(err) {
logger.error(this.handlerName + ' threw error ' + err);
}.bind(this));
var result = R.concat(renames.map(x=> {
var clone = R.clone(dependencies.find(d=>d.name == x.name));
clone.name = x.newName;
return clone;
}), dependencies);
return function(event, handelr){
var Future = _fantasy.Future;
//checkIfProcessed:: JSON -> Future<string|JSON>
var checkIfProcessed = i => Future((rej,ret) => i.isIdempotent ? ret(i) : rej('item has already been processed'));
//checkIdempotence JSON -> Future<string|JSON>
var checkIdempotency = R.curry((x,y) => R.compose(R.map(checkIfProcessed), readstorerepository.checkIdempotency(y)));
return {
function(handlers) {
var log = function(x){ console.log(x); return x; };
var Left =_fantasy.Either.Left;
var Right =_fantasy.Either.Right;
var getHandlers = R.isEmpty(handlers) ? Left('Dispatcher requires at least one handler') : Right(handlers);
//matchHandler:: handler -> bool
var matchHandler2 = x=> true;
//matchHandlers:: [handler] -> [handler]
var isValidCommand = [ef.isNonSystemEvent, matchesCommand, ef.parseData].reduce(_.curry((x,y) => x(y) ? true : false));
_ == ramda
ef.isNonSystemEvent :: object -> Myabe(bool)
matchesCommand :: object -> Maybe(bool)
ef.hasData :: object -> Maybe(bool)
require('must');
var config = require('config');
var extend = require('extend');
describe('hireTrainerTester', function() {
var eventdispatcher;
var handlers;
var options = {};
var container;
before(function () {
async handleEvent(gesEvent) {
logger.debug('handleEvent | checking event for idempotence');
var idempotency = await readstorerepository.checkIdempotency(gesEvent.originalPosition, this.eventHandlerName);
if (!idempotency.isIdempotent) {
logger.debug('handleEvent | event is not idempotent');
return;
}
logger.trace('handleEvent | event idempotent');
try {
handleEvent on the base calss
console.log(this[gesEvent.eventName]);
console.log(this[gesEvent.eventName](gesEvent.data, gesEvent.metadata.continuationId));
result
[Function: hireTrainer]
[TypeError: undefined is not a function]