javascript - How do client side applications work?
问题描述
I am a complete beginner when it comes to web development. My programming background mainly consists of algorithms as well as local windows forms showcasing said control mechanisms. In order to explain my algorithms I tend to make some visualization tools, which are great for debugging as well. I usually distribute my tools over email as a compiled exe(c++ or c# win form) to my students. (I teach mathematics for a small class)
It then came to me, how great would it be, if I wouldn't have to give everyone a copy of my tools to use and learn, but to set up a web page for my applications. Ideally the browser would load the page from the server and from then on, no communication would be necessary to use the page/application. So the application would run client side.
Is it possible to run programs like that? Can such a client side (?) program access files on a computer, like a file upload? I understand that you can upload files to servers, but the main goal would be i could just "upload" a file to the client browser from the client pc, run some code on it client side and then display some numbers. All without any communication with the server, from where the page was loaded. Would something like this possible? If so, please specify some pointers to the right directions!
Thank you in advance.
解决方案
If I understand you correctly. You Teach algorithms for a class or something like that.
I see that you already have binaries compiled. So, there's this new paradigm of running binary code on Web (YES NOT JS!), check it out here: https://webassembly.org/getting-started/developers-guide/
OR
(Re)write your algorithm(s) in JavaScript. What I mean by that is:
index.html
- algorithms.js
In algorthims.js you write function(s) like:
const binarySearch = (array, element) => {
/* your logic here */
return
}
const reverseString = (sentence) => {
/* your logic here */
}
Similarly, write other functions required.
This way you have everything loaded when the rendering is done and you can run this via just the client side
推荐阅读
- angular - 在角度问题中使用 Bootstrap 进行无限滚动
- hyperlink - Netlogo:如何向每个链接的邻居提问
- unity3d - 在 Unity 中使用 uFllex 找不到 DLL 错误
- reactjs - React createClass() 方法中的 : 符号是什么意思?
- visual-studio-code - vscode 不使用鼠标快速选择和注释代码块
- java - 从数组中排除整数以找到第二小的整数
- jquery - 视口内最长的元素
- javascript - 多线程 node.js instagram 解析器
- azure - Sql Server 2017 在 Azure Db 上可用吗?
- django - Django rest框架向序列化程序添加字段,但不会添加到每个条目中