var bricks = window.bricks || {}; function url_params(data) { return Object.keys(data).map(key => `${key}=${encodeURIComponent(data[key])}`).join('&'); } /* async function doit() { const response = await fetch("http://localhost:3000") const reader = response.body.getReader(); const decoder = new TextDecoder('utf-8'); let result = await reader.read(); var buffer = ''; while (!result.done) { const text = decoder.decode(result.value); buffer += text; const newline = /\r?\n/gm; var rez = newline.exec(buffer); while (rez){ yield buffer.substring(0, rez.index); buffer = buffer.substring(newline.lastIndex); rez = newline.exec(buffer); } result = await reader.read() } if (buffer != ''){ yield bufffer; } } // chunked response handle */ bricks.HttpText = class { constructor(headers){ /* var _headers = { "Accept":"text/html", } _headers = { "Accept": "application/json", }; */ if (!headers) headers = {}; this.headers = headers || { "Accept":"text/html", }; bricks.extend(this.headers, headers); var width=0, height=0; var is_mobile = '0' if (bricks.is_mobile()){ is_mobile = '1'; } if (bricks.app) { width = bricks.app.screenWidth(); height = bricks.app.screenHeight(); } this.params = { "_webbricks_":1, "_width":width, "_height":height, "_is_mobile":is_mobile } if (bricks.app){ this.params['_lang'] = bricks.app.lang; } } url_parse(url){ var a = url.split('?'); if (a.length == 1) return url; url = a[0]; var a = a[1].split('&'); for (var i=0;i