This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| courses:{ | |
| 1:{ | |
| lastUpdated: '', | |
| id: 1, | |
| courseTitle: 'course title 1', | |
| active: true, | |
| chapters: [1] | |
| }, | |
| 2:{ | |
| lastUpdated: '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SignInForm.js | |
| import React from 'react'; | |
| var Input = require('./FormElements/Input'); | |
| var SignInForm =() => ( <Input />); | |
| export default SignInForm; | |
| // Input.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('must'); | |
| var config = require('config'); | |
| var extend = require('extend'); | |
| describe('hireTrainerTester', function() { | |
| var eventdispatcher; | |
| var handlers; | |
| var options = {}; | |
| var container; | |
| before(function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] | |