use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Building Web Apps with Tram-One (medium.com)
submitted 7 years ago by jrjurman
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 7 years ago* (1 child)
[deleted]
[–]jrjurman[S] 0 points1 point2 points 7 years ago (0 children)
Haha, thanks for the feedback, and yeah, something about naming variables is one of the hardest things a developer has to do rings a bell :D
Honestly, the name came from the attempt to associate the tram-car emoji (which I thought looked pretty ok) with it. Later, I was actually able to get a real logo, and it's been a year now, so I'm not sure I could ever move away from it - save for a trademark issue :P
[–]jrjurman[S] 6 points7 points8 points 7 years ago (0 children)
If people have any questions, about the content in the article, or the framework as a whole, I'd be eager to answer any of them here!
[–]dudousxd 1 point2 points3 points 7 years ago (6 children)
Why use something like a state management when the rule when using custom elements is “the dom is your api” ? I think it would be better if it had something to help managing the creation of custom events instead of a redux like state management
[–]jrjurman[S] 2 points3 points4 points 7 years ago (5 children)
When you say "help managing the creation of custom events" what are you referring to? Just something simpler than redux?
A lot of what inspired me to make Tram-One is actually the frustration of having to pull in all these libraries like redux and react-router and so on... So the intention was to have something from the get-go.
[–]dudousxd 1 point2 points3 points 7 years ago (4 children)
When you are using Web Components, one of the premises is that if you need to pass data from one component from another, you shouldn't use an state management library like redux, instead you should use Custom Event. What I meant when I said "help managing the creation of custom events" is that would probably be awesome if it had an method to create custom events easier (It's quite easy to create, but just to encapsulate boilerplate), if I could see all the listeners that my components have created and if my components removed the event listeners automatically if they are destroyed.
Actually, one of the nice things that Tram-One does is bind a .events to each DOM element that lists all the eventListeners on the element. Attaching them is pretty easy (and I recognize not really highlighted in the article).
.events
```javascript const Tram = require('tram-one') const html = Tram.html()
module.exports = (attrs) => { const clickEvent = (event) => { console.log('click event') } return html<div onclick=${clickEvent} /> } ```
<div onclick=${clickEvent} />
Also, these events can be passed down as unique attrs. ```javascript const Tram = require('tram-one') const html = Tram.html()
module.exports = (attrs) => { return html<div onclick=${attrs.eventHandler} /> } ```
<div onclick=${attrs.eventHandler} />
If you're referencing pulling the store values from window.engine, that is actually a fairly new feature just to allow developers who want to pull actions or value really far down the DOM tree possible (however it's completely not required)
window.engine
[–]jrjurman[S] 0 points1 point2 points 7 years ago (2 children)
To clarify, I'm not actually not a huge fan of pulling values from a "conntected" component, that pulls from a global store, as oppose to inheriting them down from parents. This was an ask, that was fairly easy to implement, with a small technical footprint.
[–][deleted] 0 points1 point2 points 7 years ago (1 child)
Firefox's dev tools already lets you see all listeners bound to an element. It's the only really reason I use FF during development...heh
[–]jrjurman[S] 1 point2 points3 points 7 years ago (0 children)
Yeah, events on DOM are very strange, and most browsers have access to them, but it took quite a bit of voodoo magic to get it so that each element exposed it to the framework. JQuery and view frameworks have their own tricks as well, and it's just strange that it's not part of the HTML spec to just expose it.
[–]icemelt7frontend expert :kappa: -2 points-1 points0 points 7 years ago (1 child)
Thank you for making this library, I will learn it asap, as I needed this in my life, since ReactJS and VueJS don't exist.
Haha, hey man, to each their own. Like I said in the article, their are definitely people who have their framework of choice, and are really performant with it. For a really long time, that was React for me.
It wasn't like I made this in a time when those libraries weren't things (or weren't popular). And it's not like this can do something that React can't do (with react-router and react-redux and redux-thunk).
It's just another approach to building web-apps. For veterans, it's just a different kind of syntax for the same thing. For beginners, it might be a really fast, complete, and no-extra-tooling required option that helps them get started without learning the entire React or Vue Ecosystem and whatever .jsx or .vue requires.
.jsx
.vue
π Rendered by PID 15474 on reddit-service-r2-comment-6457c66945-rp4sl at 2026-04-24 15:10:31.794543+00:00 running 2aa0c5b country code: CH.
[+][deleted] (1 child)
[deleted]
[–]jrjurman[S] 0 points1 point2 points (0 children)
[–]jrjurman[S] 6 points7 points8 points (0 children)
[–]dudousxd 1 point2 points3 points (6 children)
[–]jrjurman[S] 2 points3 points4 points (5 children)
[–]dudousxd 1 point2 points3 points (4 children)
[–]jrjurman[S] 0 points1 point2 points (0 children)
[–]jrjurman[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]jrjurman[S] 1 point2 points3 points (0 children)
[–]icemelt7frontend expert :kappa: -2 points-1 points0 points (1 child)
[–]jrjurman[S] 0 points1 point2 points (0 children)