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
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using Microsoft.Bot.Builder; | |
| namespace Microsoft.BotFramework.Composer.WebApp.Middlewares | |
| { | |
| public class ChannelDataMiddleware : IMiddleware | |
| { | |
| public async Task OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken = default) | |
| { |
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
| interface StatePropertyAccessor { | |
| get(context):any | |
| } | |
| // this user state implements many interfaces | |
| class UserState implements StatePropertyAccessor { | |
| constructor(public data?:Object, public _parent?:UserState, public _name?:string) { | |
| if (data == null) |
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
| // this state is just a simple observer | |
| class State { | |
| constructor(public data: object) { | |
| this.walk(data); | |
| } | |
| walk = (obj: Object) => { | |
| this.data = obj; | |
| for (let k in obj) |