Replies: 20 comments
-
I don't know if my request is too heavy for sciter.js, but the future is there. At least, consider adding the features not needed by the app through a dynamic library that will be used solely for development purposes. I recommend that you focus on the use of https://github.com/vitejs/vite and https://www.snowpack.dev/ whenever possible. Reactive frameworks are moving away from bundlers to Native ES modules during development. The bunlders are staying there to focus solely on bundling production builds. This modern approach is tested to be much lighter for development (creation for projects, neat package.json, starting development Server and HMR). Vite: Snowpack: Requirements for vite and snowpack
|
Beta Was this translation helpful? Give feedback.
-
Could you elaborate more on that? In particular purpose "a dynamic library that will be used solely for development purposes".
Not sure I understand how Sciter.JS is related to all that. And what is so difficult in hot reload?
Are we talking about desktop UI here? |
Beta Was this translation helpful? Give feedback.
-
Adding some features may improve the developer's experience, but they may not be needed by a production app. You may have some reservations about a possible negative impact on binary size, and that's why I'm suggesting a work around for this if any.
You already said 'Makes sense to try to port any of these.', and that's whey I wanted to share my thoughts. Usually, developers depend on ready made templates to kick starting new reactive projects. Vite and Snowpack are the new school tools to achieve this and Sciter.js is already having supprort for modern javascript syntax. They're just exploiting the web standard, and by focusing on their requirements from the browser side during development, we should be able to use them with sciter.js:
In fact, I'm planning to give it some efforts, but let's seek stability first (native modules, parent.removeChild, WebSocket, etc...) |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
For your problem with svelte, just change text.data to text.nodeValue using @rollup/plugin-replace and it's already explained by me in a different issue created by another person Since you're the one who discovered the problem about |
Beta Was this translation helpful? Give feedback.
-
Yeah I realize, my bad. I think we could make an umbrella issue for the issues regarding these frameworks and libraries though. |
Beta Was this translation helpful? Give feedback.
-
@intrnl Opening an umbrella issue about reactive frameworks is better be done in a place like a forum and I'd rather recommend opening a general topic, followed by more focused topics for some frameworks.
But I might be wrong for a simple reason: I'm already registered at https://sciter.com/forums/ but I can't create any post at the moment (I'm new), and my comments aren't landing there yet. I'm starting to worry about others not to be able to join our discussions if any. Maybe creating some projects at Github is much better @c-smile What would you suggest about this? |
Beta Was this translation helpful? Give feedback.
-
To @jsprog : it does not matter at this stage where feature requests will appear. But all this should really be more organized, so forum is better, I think. But it could be also Wiki page here. At this phase (this November) I am aiming on two goals:
|
Beta Was this translation helpful? Give feedback.
-
@intrnl, I cannot find any mentioning about |
Beta Was this translation helpful? Give feedback.
-
the 'data' property is valid for 'text nodes' and 'comment nodes' and the information about it is quite limited. just use google and type 'textNode.data vs' svelte is updating
According to my last test with malina.js (think of it as a deviation from svelte with support for other features) I could confirm that they're using
to @intrnl, I think that we can use this topic to write about DOM features failing with sciter.js and sorry for my previous words |
Beta Was this translation helpful? Give feedback.
-
@c-smile: Anyway to reload the window (like F5) from javascript. I needed this since 2 days to proceed with tests, to later share back my full work. |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
I already started my first git repository jsprog/sciterjs-svelte-template to share with others my work about bringing the default svelte template to sciter.js. No content at the moment, but It should be there very soon. By doing this, I'm trying to:
|
Beta Was this translation helpful? Give feedback.
-
I created sciterjs-svelte-template, that would help developers in kick starting their sciterjs+svelte projects will less efforts. Others interested in knowing the details behind this work, may read svelte_to_sciterjs_startup_instructions.md More is coming soon
|
Beta Was this translation helpful? Give feedback.
-
to @c-smile: We need an alternative to Is it possible to achieve this with javascript only? |
Beta Was this translation helpful? Give feedback.
-
See: https://github.com/c-smile/sciter-js-sdk/blob/main/samples/debug-peer.js#L65 |
Beta Was this translation helpful? Give feedback.
-
Thank you, I succeeded with live reload with minimal changes (svelte). It's not fully perfect, but It's working and It should help developers coding faster.
<!-- index.html: place this before the main script -->
<script>
!window.location && (window.location = { "host": 'localhost' })
</script> // top of main.js
import './livereload_fix' // livereload_fix.js
// note-1: This isn't final and expect it to change with improvements and some fixes
// note-2: The port is hardcoded to the default value used by livereload (35729)
// note-3: Unwanted logs after closing the app (only if you used 'new WebSocket(uri)' at least once)
// note-4: Handshaking with the dev server isn't implemented yet.
// - issue: the reason behind this is that the app will crash with "Segmentation fault (core dumped)"
// if it tried to connect to a disconnected websocket server
// note-5: I'm not sending the 'hello' command on connection
// (ws.send(JSON.stringify({ command, 'hello', ...other-params }))
// - doing this will case the server to send a reply, that I'm trying to avoid this time,
// because I'm only receiving empty messages
// note-6: I'm only receiving empty messages from the development server,
// and I'm debouncing them to trigger the reload
// - likely I'm not sending the 'hello' command with the correct parameters (not sure)
// note-7: the script injection for livereload-js is kept as it is for these reasons:
// - To keep compatibility with browsers
// - It has no effect to Sciter.js
import debounce from 'lodash/debounce'
const debounce_duration = 200
const reconnection_timeout = 1000
const ws_uri = `ws://localhost:35729/livereload`
if (Window.this) {
let ws
const debounce_then_reload = debounce(() => {
document.dispatchEvent(new Event("reloaddocument", {bubbles:true}),true);
}, debounce_duration)
function connect () {
ws = new WebSocket(ws_uri)
ws.onopen = () => {}
// just crash the app if the connection with server is closed.
// Better than keeping it to not receive the updates from a restarted server
ws.onclose = () => { setTimeout(() => { connect() }, reconnection_timeout) }
ws.onmessage = () => { debounce_then_reload() }
ws.onerror = (err) => {}
}
connect()
} // rollup.config.js
production && replace({
delimiters: ['', ''],
// we don't need livereload_fix for production builds
"import './livereload_fix'": ""
}),
replace({
delimiters: ['', ''],
// fix: use alternative supported syntax
"l.getElementsByTagName('head')[0].appendChild(r)": "document.head.appendChild(r)",
// fix: no setter for property
"r.id = 'livereloadscript'": "Object.defineProperty(r, 'id', { value: 'livereloadscript' })"
}), // example App.svelte
<script>
let count = 0
setInterval(() => {
count++
console.log('count:', count)
}, 1000)
</script>
<div>Count: {count}</div> @c-smile: The next steps are:
|
Beta Was this translation helpful? Give feedback.
-
What's the problem with WebSockets? As of preserving navigation, I will add |
Beta Was this translation helpful? Give feedback.
-
I can't say too much about this without some extensive tests. Sorry about this, I had to spend my day tracking some hard to recreate CSS bugs, and I'll try to report about them within 24 hours).
I think that you understand better than me. I suggested to keep navigation state across reloads and you're suggesting something that would help with:
Sometimes, the programmer may prefer to start with a new state. In this case, he should be able to reload without keeping state. For this, we've got some scenarios:
|
Beta Was this translation helpful? Give feedback.
-
Question: Are there plans for Web Workers or Worker Threads? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Tasks that I think make sense to do at this moment:
Native components and extensions (plugins):
Video provider native behavior
Idea
Idea is to wrap ffmpeg lib as video source behavior for Sciter. The code can be based on behvaior_video_generator and How to Write a Video Player in Less Than 1000 Lines tutorial.
Output
Ideally implementation should support as static linkage as a dll (sciter-ffmpeg.dll). Pretty much in the same way as current SQLite component that supports dual linkage.
Goals
This project will help to establish mechanism for loadable native behaviors.
It is not clear yet what such behaviors will need from Sciter side (other that passing Sciter API reference as it is).
Goals
Ideally implementation should be "promise capable" - so the project will help to establish API for native promises.
Scripting frameworks and components
VueJS and ReactJS
Makes sense to try to port any of these.
Goals
These will help:
Any popular Charts library
The one that use
<canvas>
for rendering.Goals
To test and improve my current quite basic
<canvas>
implementation.Maps
Leaflet anyone?
Please let me know if you want to take any one of these or have other ideas.
Chat Component
Idea
That's brand new component that needs to be designed from scratch. And I will help as much as I can on this.
Seems like many of us need a component that can be built-in into applications.
Something along the lines of Slack, Skype, etc:
Goals
This will end up with "virtual tape" - tape of messages. We need to decide if script is enough for that or do I need to add native support for virtual lists.
Beta Was this translation helpful? Give feedback.
All reactions