Code · 86 lines · 1642 bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86const output = $id('Output');

const input = {
	"SomeParameter4":
	{
		Name: "four",
		"Users":
			[
				[{ Name: "User00", Alias: ['aliasa', 'aliasb', 'aliasc'] }, { Name: "User01" }],
				[{ Name: "User10" }, { Name: "User11" }],
				[{ Name: "User20" }, { Name: "User21" }]
			]
	},
	"SomeParameter5": 5.5 // double binder
};

const largeJson = { users: [], metadata: {} };

for (let i = 1; i <= 1000; i++)
{
	largeJson.users.push({
		id: i,
		name: `User ${i}`,
		email: `user${i}@example.com`,
		address: {
			street: `${i} Example Rd`,
			city: "CityName",
			zipcode: `ZIP${i}`
		},
		preferences: {
			theme: i % 2 === 0 ? "dark" : "light",
			notifications: i % 3 === 0
		}
	});
}

largeJson.metadata = {
	totalCount: largeJson.users.length,
	generatedAt: new Date().toISOString()
};


//console.log(JSON.stringify(largeJson));

onReady(() =>
{
	PageEvents();
	Init();
});

function PageEvents()
{
	document.on("click", async function (e)
	{
		if (e.target.id && typeof window[e.target.id] === "function")
		{
			const func = window[e.target.id].call(e, e);
			if (func instanceof Promise)
				await func;
		}
	});
}

function Init()
{
	netproxy("./api/HelloWorld"); // Makes session (and cookie)
}

async function SpeedTest()
{
	output.innerText = '';

	const tasks = Array.from({ length: 4 }, () => MultiBinderTest());
	await Promise.all(tasks);
	console.log("All tasks completed");
}

async function MultiBinderTest()
{
	const result = await netproxyasync("./api/Speedtest/two?SomeParameter3=three&SomeParameter6=6", input);
}

async function LargeJson()
{
	await netproxyasync("./api/LargeJson", { largeJson: largeJson });
}