Created
November 14, 2015 18:29
-
-
Save lsem/1566b08ccbc83caaaf0c to your computer and use it in GitHub Desktop.
ESkills TypeScript extension example
This file contains 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
import _ = require('underscore') | |
import assert = require('assert') | |
import util = require('util') | |
function denormalizersFactory(services: ExtensionTypes.IDenormalizerExtenionServices) : ExtensionTypes.IExtensionDenormalizers { | |
services.sayDenormalizingHello() | |
return { | |
onXXX: function (event: any) { | |
// .. | |
}, | |
onYYY: function (event: any) { | |
// .. | |
} | |
} | |
}; | |
function commandAPIFactory(services: ExtensionTypes.ICommandAPIExtensionServices) : ExtensionTypes.ICommandAPI { | |
let commandAPI: ExtensionTypes.ICommandAPI = { | |
routes: [ | |
] | |
} | |
return commandAPI | |
} | |
function queryAPIFactory(services: ExtensionTypes.IQueryAPIExtensionServices) : ExtensionTypes.IQueryAPI { | |
services.sayQueryAPIHello() | |
let queryAPI: ExtensionTypes.IQueryAPI = { | |
routes: [ | |
{ | |
method: 'get', | |
url: '/example', | |
handler: function(request, response) { | |
} | |
} | |
] | |
} | |
return queryAPI | |
} | |
function commandHandlerFactory(services: ExtensionTypes.ICommandHandlerExtensionServices) : ExtensionTypes.ICommandHandler { | |
let commandHandler: ExtensionTypes.ICommandHandler = { | |
onXXXCommand: function (xxxCommand) { | |
services.sayCmdHandlerHello() | |
} | |
} | |
return commandHandler | |
} | |
// Description | |
exports.denormalizerFactory = denormalizersFactory; | |
exports.queryAPIFactory = queryAPIFactory; | |
exports.commandAPIFactory = commandAPIFactory; | |
exports.commandHandlerFactory = commandHandlerFactory; | |
exports.idname = "TSExtExample"; | |
exports.author = "lsem"; | |
exports.permissions = []; | |
exports.dependencies = []; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment