I decided to indulge in TypeScript and es6, and in particular Proxy.
The problem is that in the debugger (Edge) both the content and the length of the arguments are shown, but in the code all methods for converting to the array are returned [] or calls to the length return 0.
class Item { constructor(public resolve: any, public value: any) { }; } class CounterComponent { public currentCount: any; private dictionary = {}; private proxy: any; constructor() { this.SetProxy(); } private SetProxy(): void { this.proxy = new Proxy({}, { get: (rcvr, name) => { return () => { let args: Array<any> = []; let length = arguments.length; //length==0 let args1 = [...arguments]; //args1==[] for (let i = 0; i < arguments.length; i++) { args.push(arguments[i]); } let promise = new Promise((resolve, reject) => { // resolve(123); let item = new Item(resolve, args); this.dictionary[name] = item; }); return promise; }; } }); } public async CallMethodAsync() { this.currentCount = await this.proxy.AllHello("Всем Привет"); } public setResult(): void { let key: string; for (let name in this.dictionary) { key = name; } let item = <Item>this.dictionary[key]; item.resolve(item.value); } } At the same time await fulfills. And is there any analogue of the C # finalizer to understand when an object is subject to garbage collection?
SetProxy- Grundy