Zidan
Zidan
Explore posts from servers
KPCKevin Powell - Community
Created by Zidan on 8/25/2023 in #front-end
SVG not displaying
i'll read about, thanks a lot
22 replies
KPCKevin Powell - Community
Created by Zidan on 8/25/2023 in #front-end
SVG not displaying
xD
22 replies
KPCKevin Powell - Community
Created by Zidan on 8/25/2023 in #front-end
SVG not displaying
what is RDF?
22 replies
KPCKevin Powell - Community
Created by Zidan on 8/25/2023 in #front-end
SVG not displaying
i see..
22 replies
KPCKevin Powell - Community
Created by Zidan on 8/25/2023 in #front-end
SVG not displaying
thing is, i did this many times before, i even have a function that toggles between to SVGs to show and hide a text in a password input like so :
const target = e.target
const input = target.previousElementSibling
if (target.className === `active`) {
target.innerHTML = `
<svg viewBox="0 0 20 20">
<polygon points="20 8 20 12 0 12 0 8 2 8 2 10 18 10 18 8 20 8"/>
</svg>
`
target.className = ``
target.title = `show`
input.type = `password`
} else {
target.innerHTML = `
<svg viewBox="0 0 20 20">
<polygon points="20 16 20 20 0 20 0 16 2 16 2 18 18 18 18 16 20 16"/>
<polygon points="20 0 20 4 18 4 18 2 2 2 2 4 0 4 0 0 20 0"/>
<path d="M20,15l-5,5,5,5,5-5Zm-1,5,1-1,1,1-1,1Z" transform="translate(-10 -10)"/>
</svg>
`
target.className = `active`
target.title = `hide`
input.type = `text`
}
const target = e.target
const input = target.previousElementSibling
if (target.className === `active`) {
target.innerHTML = `
<svg viewBox="0 0 20 20">
<polygon points="20 8 20 12 0 12 0 8 2 8 2 10 18 10 18 8 20 8"/>
</svg>
`
target.className = ``
target.title = `show`
input.type = `password`
} else {
target.innerHTML = `
<svg viewBox="0 0 20 20">
<polygon points="20 16 20 20 0 20 0 16 2 16 2 18 18 18 18 16 20 16"/>
<polygon points="20 0 20 4 18 4 18 2 2 2 2 4 0 4 0 0 20 0"/>
<path d="M20,15l-5,5,5,5,5-5Zm-1,5,1-1,1,1-1,1Z" transform="translate(-10 -10)"/>
</svg>
`
target.className = `active`
target.title = `hide`
input.type = `text`
}
and its working fine..
22 replies
KPCKevin Powell - Community
Created by Zidan on 8/25/2023 in #front-end
SVG not displaying
okay, i'll try
22 replies
DDeno
Created by Zidan on 8/10/2023 in #help
Serving multiple static files to an HTTP request
I have divided my SPA's UI into what I named components, modules and events. A component is function that returns an HTML element. A module is function that uses components to build pages, forms, popups Etc. An event is a function that is called by a component. All of the above is loaded on demand only, so each module function has an array for component dependencies that are checked for availability (are X, Y, Z already loaded?) before the module attempts to use them. And if they are available, the availability function (which returns a promise) just fulfills. And if one or more of the component dependencies are missing, it runs a Promise.all() on an array of import() statements to request the component files and their corresponding CSS files one by one, then fulfills or rejects accordingly. And this is working just fine for now, but I wanted to see if I can request all files at once instead of one by one. So I wanted to try HTTP/2 server push in Deno but then found that its no longer supported. Then you suggested using the FormData object which would allow me to send a list of files like I wanted to achieve, expect that it involves creating and appending <script> and <link> HTML tags to the DOM for each file, which I would like to avoid.
37 replies
DDeno
Created by Zidan on 8/23/2023 in #help
Closing a file
got it, thanks a lot
10 replies
DDeno
Created by Zidan on 8/23/2023 in #help
Closing a file
and then check only the file open for erros i think?
10 replies
DDeno
Created by Zidan on 8/23/2023 in #help
Closing a file
file.stat appears to be a function that returns a promise now.. is there a way to get the file size in the same .then() or do i have to chain another .then?
10 replies
DDeno
Created by Zidan on 8/23/2023 in #help
Closing a file
oh, that's convenient got it, thanks 👍
10 replies
DDeno
Created by Zidan on 8/10/2023 in #help
Serving multiple static files to an HTTP request
In my novice mind. A user sends a sign in request with their credentials, if successful, I would respond with body like this:
{ user: { id: '', name: '', phone: '' }, files: [ file/blob, file/blob ] }
{ user: { id: '', name: '', phone: '' }, files: [ file/blob, file/blob ] }
and the files would work without the need to create and append script elements like when done using import. Instead of responding with just user data + files names so that a pre existing function can import them one by one.
37 replies
DDeno
Created by Zidan on 8/10/2023 in #help
Serving multiple static files to an HTTP request
Like auto caching? Man, do I have a lot of reading to do xD Thanks for the heads up
37 replies
DDeno
Created by Zidan on 8/10/2023 in #help
Serving multiple static files to an HTTP request
Wow, hack/worth or not, I did not know about any of the approachs you mentioned. Thanks a lot. Now, I did some reading on FormData and Blobs. And wondering if it's possible to use the JS/CSS files from a FormData Blob without creating/appending script tags like when using import? Or is this the only way for that approach?
37 replies
DDeno
Created by Zidan on 8/10/2023 in #help
Serving multiple static files to an HTTP request
I see.. Well, I'm using Promise.all() at the moment. That shouldn't be blocking so I'll just keep using that. Thanks for the clarification.
37 replies
DDeno
Created by Zidan on 8/10/2023 in #help
Serving multiple static files to an HTTP request
Not a performance issue, no. It's about efficiency really. A request and a response per file sounds very wasteful to me. So I wondered if I can send multiple responses per request if the request already has an array of the needed files. @pyrote mentioned a zip file with all the requested files. So that would be 1 request and 1 response per several files, which sounded pretty good to me 😄. @guest271314 mentioned a single JSON response with the files. No idea how that works 😕.
37 replies
DDeno
Created by Zidan on 8/10/2023 in #help
Serving multiple static files to an HTTP request
My use case: I'm building an SPA. and have JS files for UI components and their corresponding CSS files. A function that renders a form needs 4 UI components for different field, buttons and so on. The form rendering function checks if those 4 UI components are available before attempting to use them. If not found, it requests them with an import statement one by one, then requests the corresponding CSS files one by one too. A ZIP file with all the requested files sounds good. But I don't know how to do that. Can you illustrate or link an example?
37 replies
DDeno
Created by Zidan on 8/10/2023 in #help
Serving multiple static files to an HTTP request
I don't know how to do that. Can you illustrate or link an example?
37 replies
DDeno
Created by Zidan on 7/16/2023 in #help
How to serve HTTPS with the Deno.serve() API
I see, thank you
168 replies
DDeno
Created by Zidan on 10/1/2022 in #help
ReadableStream to JSON
worked!, thanks a lot!!
9 replies