Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey
Filter by
Sorted by
Tagged with
0 votes
0 answers
48 views

How to efficiently toggle components using Mithril.js

I have a list of some data. I want to display and edit that data. My Home component iterates over this data and display using Item component it Each row has data and edit button. After clicking on ...
Shail's user avatar
  • 29
0 votes
1 answer
52 views

Mithril app crashing when open multiple tabs/popups

I'm working on a project using Mithril, and on a table whenever I click an element it opens a popup Component which is basically composed by 4 divs nested into each other and the deepest one is ...
Ernanni's user avatar
  • 428
1 vote
0 answers
53 views

Certain Formatting Options No Longer Work, mithril js, quill js, quillRenderer, sass

Our company's site utilizes typescript, Mithril js, Quill JS, (also quill renderer), and sass. Certain styling options that worked before changing to the quill renderer have stopped working. The ...
Rick Ansay's user avatar
0 votes
1 answer
98 views

Mithriljs add onkeydown event when component is created

I am trying to initialize an onkeydown event when a component is created: var KeyboardComponent = { parse: function(e){ console.log("pressed: " + e.key); }, view: ...
happy songs's user avatar
1 vote
0 answers
300 views

Mithril js framework, enable hot reload?

I am using Mithril javascript framework with Vite bundler. Application is really complex and during debugging, for every change (even a small HTML edit), it takes me like 10-20 seconds to get to the ...
ajaleksa's user avatar
  • 376
0 votes
1 answer
287 views

Mithril JS input checkbox events and element refresh

Working on a SPA with Mithril.js (love it!), but having a problem with input checkboxes not behaving correctly when I assign an "onchange" listener to them. var Widget = { view: function(...
tcw's user avatar
  • 3
0 votes
1 answer
98 views

using return of async function in view()

I previously had a simple component that looked something like this, but previously the getIsLoggedIn method was synchronous. We recently had to change that method to async, so I tried adding the ...
Tony's user avatar
  • 1
1 vote
1 answer
773 views

Google Publisher Tag Reward Ad reloads Mithril SPA unexpectedly

When I run this code in my localhost server and I click the Show Ad button in the #!/reward page, the reward ad shows but sends me back to the #!/ page. However, in this online code editor this SPA (...
Fernando Sanchez's user avatar
0 votes
2 answers
249 views

Typescript requires mithril import that breaks in javascript

Currently translating my javascript app to typescript. Previously I was just using m() and Vnode without any imports, but typescript wants needs to include import m, { Vnode } from 'mithril'; so it ...
Natalie's user avatar
  • 103
0 votes
0 answers
89 views

Async function FileReader issue - console.log() array works fine but shows length as 0 [duplicate]

async function parseFile(file, type) { const fileSize = file.size; const chunkSize = 1024 * 1024; // bytes let offset = 0; let chunkReaderBlock = null; const hash = sha1.create(); const ...
Sukhamjot Singh's user avatar
1 vote
2 answers
131 views

Recursive Mithril View function - not rendering further

Here is a DisplayComment function. I want to make a comment thread. Basically a reply structure kind of thing. Each parent comment is displayed in the table and I want to render its replies just below ...
Sukhamjot Singh's user avatar
2 votes
1 answer
218 views

Getting a NodeList of the HTML tags in Mithril

Is there a way of having a NodeList of the HTML tags in Mithril? I need to get the width of the blocks. Something like that on vanilla js: const blocks = Array.from(document.querySelectorAll('.blocks')...
vasilek_'s user avatar
0 votes
1 answer
156 views

Map 2 arrays in Javascript

I'm trying to display the content of 2 arrays of contained in an object. When I map RType.information.Type the content of the array "Type" is displayed. But nothing happened if I want to ...
Simon Leviev's user avatar
1 vote
1 answer
266 views

render a canvas in mithril

how can i render a canvas inside mithril ? here is my typescript code : import * as mithril from 'mithril'; import m from 'mithril'; import * as PIXI from 'pixi.js'; var root = document.body // The ...
Bussiere's user avatar
  • 1,124
1 vote
0 answers
204 views

Mithrill Error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle<Attrs, State>'

I am new to Mithril. I am trying to follow this example for a pretty basic start: https://github.com/spacejack/mithril-ts-example. Here are my package.json, and tsconfig.json : # package.json { &...
Adina's user avatar
  • 129
0 votes
2 answers
310 views

How to redraw specific DOM asynchronously in Mithril

I have sub-components that are updated by injecting state from the parent component. I need to populate the model using an asynchronous function when the value of the parent component changes. And I ...
COLEAN's user avatar
  • 695
0 votes
2 answers
563 views

Setting an attribute dynamically in mithril.js

I'd like to set an attribute in mithril.js inside the oninit function. For example, m('img', { oninit: (vnode) => { vnode.attrs.src = 'A url string'; } }) I want to check for ...
Sujit's user avatar
  • 1,792
0 votes
1 answer
321 views

How to use another js in mithril.js

I need to include a third-party js library in my website and a working example in plain HTML file is something like <div id="app"></div> <script src="app.js"></...
CoolMoon's user avatar
  • 177
0 votes
1 answer
482 views

Codemirror doesnt style code from textarea

I can't get a solution from this. an help will be appreciated import CodeMirror from "codemirror"; export default class RealTimeEditor extends Page { view() { window.onload = ...
Marco Colia's user avatar
1 vote
2 answers
850 views

Why does the Mithril child component state change not trigger an update?

The following code works as expected: it creates two counter buttons that persist their state and update on clicking: let Counter = function (vnode) { let count = 0 return { view: (vnode) =&...
phi_land_trophyist's user avatar
-1 votes
1 answer
519 views

Having issue of rendering Mapbox map from any ID other than "app"

I'm trying to implement Mapbox gl gs into a project I'm building with Mithril and am having issues with getting a map to render from any ID other then "app". Within the body of my html I ...
Daniel Patnode's user avatar
0 votes
1 answer
340 views

How to trigger onchange event in an IFrame mithril element when a codemirror editor in the srcdoc of the IFrame changes?

Let's say I have a HTML called post.html that has a codemirror editor in it. the post.html looks something like: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js&...
AdhityaRavi's user avatar
0 votes
2 answers
245 views

Returning empty object from POST request (mithril w/ Node and Express)

Currently having an issue where a object with null values for all content except ID is returned when trying to complete a POST request from my front end. I'm also not receiving any error messages in ...
Daniel Patnode's user avatar
1 vote
1 answer
140 views

How does Mithril component work here is some weird experience I had

I was going through documentation and I ran following code in script.js var Article = { view: function(vnode) { console.log(vnode) return "This is article " + vnode....
pr0mpT_07's user avatar
  • 184
0 votes
1 answer
242 views

Why is the state overwritten by the attributes in the latest instance for all instances of a component when using IIFEs with Mithril.js?

I'm trying out Mithril.js and have made three small components. let Map = (function() { let Map = {}; let parent; Map.oninit = function(vnode) { parent = vnode.attrs.parent; } ...
Commander's user avatar
1 vote
1 answer
81 views

JS function result not rendering

I'm trying to render the result of the function renderVerticalCards, but nothing is returned in the DOM, other than the outer divs (those from outside the function call). I have confirmed through the ...
Jakob Handberg Lystbæk's user avatar
1 vote
1 answer
390 views

Using Mithril.js, how can I add options given by an async function, to a previously added select element

I'm trying to add options to a previously created Vnode (select element). The element is returned before the options are available, since they come from an async function. Although I try to set the ...
Jorge Cavaleiro Dias's user avatar
0 votes
2 answers
910 views

Mithril: how to use multiple root elements?

When using m.route, does everything under it have to be rendered using Hyperscript (not counting JSX)? Is it possible to mix pure HTML with multiple separate parts rendered using Hyperscript? Suppose ...
Prid's user avatar
  • 1,614
3 votes
2 answers
306 views

Error `Template parameter names *must* be separated`

I am using mithril.js in frontend application and backend application is running on ipv6 environment. Calling post ajax request to backend using mithril.js. async post(url, body = {}) { return ...
Himanshu Patel's user avatar
0 votes
1 answer
219 views

Prevent duplicates created by Mithril while sorting elements with SortableJS

I am making an dahboard creator tool. Dashboard is set of rows, each row have boxes. So I trying to make list of lists of items. Items can move between lists. Lists can be sorted between each other. ...
Vladimír Mlázovský's user avatar
0 votes
2 answers
436 views

JSX Curly Braces Inside Script Tag?

This is a silly question but it's stumped me for a while now. I'm currently trying to design a Mithril.js component that returns a <div> object that includes a <script> tag. I've just ...
paulinho's user avatar
  • 302
0 votes
1 answer
281 views

How to incorporate D3 svg elements into mithril.js?

I have been working with a framework using mithril.js and wish to add this script that draws an interactive tree into a component on my website. So far, I just placed the JS code inside the script ...
paulinho's user avatar
  • 302
0 votes
1 answer
109 views

Why is creating a new array instead of emptying the old one causing a problem here?

I'm working on a project in Javascript and hit a problem that I don't understand. Basically I've written a map generator that is generating maps from noise, that bit is fine and working. I want the ...
adaliabooks's user avatar
0 votes
1 answer
543 views

In mithril.js, onremove and onbeforeremove events not firing, while oninit and oncreate are

File TodoApp.js: ... const Todo = { oninit(vnode) { ... // ok }, oncreate() { ... // ok }, onbeforeremove() { ... // not firing }, onremove() { ... // not ...
ashark's user avatar
  • 28
0 votes
1 answer
481 views

simple bar plot with mithril.js and d3.js

I am very very new to javascript and mithril.js. I am trying to create a very simple bar plot using mithril.js and d3.js. But, I am not having any luck even getting the axis in place. Firstly, I ...
AdhityaRavi's user avatar
0 votes
1 answer
640 views

How to disable button in after click in mithril.js to prevent multiple clicks

I was able to disable the button after click but the page is not getting submitted, it just got disabled. How can I submit the page and prevent it from multiple clicks in mithril.js? m(".submit", m("...
PRONAY PRAMANIK's user avatar
0 votes
1 answer
1k views

Updating component with async function in mithirl.js

I'm trying to get some initial data for a component using an async function oninit then updating that component each time 'Show more' button is clicked. Here is the component: const Listings = { ...
Alin Climente's user avatar
0 votes
1 answer
509 views

How to force Mithril to redraw without diffing? (integrating dragula in Mithril)

I am translating a JQuery-based app to Mithril. That app uses Dragula to allow drag/drop to reorder lists. Dragula reorders the li elements in the DOM. When the Drop event is fired, I sync the model ...
rupps's user avatar
  • 9,877
0 votes
1 answer
137 views

How does one create a function to call itself when a given condition is true in Mithril.js

This is my mithril code: m('input', { id: 'someBox', placeholder: 'Type something', oninput: () => { query = document.getElementById('someBox).value; //do something ...
Sujit's user avatar
  • 1,792
1 vote
2 answers
1k views

How to use 'value' of input tag in mithril.js

I want to be able to store the value of the text inputted in a variable. I thought something like would work: m('input', { placeholder: 'Type to search...', oninput: () => { alert(this....
Sujit's user avatar
  • 1,792
0 votes
1 answer
89 views

Mathjax won't reload when using mithril mount function

I am using Mithril and am dynamically mounting some content. the first time the page loads everything works fine. Once I click a button, which causes one thing to unmount and another to mount, the ...
Michael Stachowsky's user avatar
0 votes
1 answer
903 views

Using Mithril.js, why does my onclick handler not modify the mithril component?

I am making a quiz web app. I have a class called an "answerBox", which currently just contains a button, an ID, and a Boolean. I want to call a "check Answer" function that determines if my answer ...
Michael Stachowsky's user avatar
0 votes
1 answer
52 views

Security Concerns with m.trust()

I'm trying to use a diff library in order to log edit histories of user posts for my page. That library gives me a long JSON data for diffs to store in my database and i am using the same repository's ...
linx's user avatar
  • 1
0 votes
0 answers
133 views

How to propagate message to children on a Mithril Widget

I have a mithril ListWidget that displays a list of Items. The icon you see on the right allows to expand and collapse the details. It is a field "expanded" in each Item vnode state. Now I want to ...
rupps's user avatar
  • 9,877
0 votes
0 answers
199 views

Preventing component redraw Mithril + ChartJS

I'm trying to draw in a canvas created in a Mithril's component. My problem is that I don't want this component's view to be redrawn when the application needs. I found that the onremove/oncreate ...
Arthur T's user avatar
1 vote
1 answer
413 views

Configuring webpack, babel and mithril.js

I'm trying to get webpack and babel working (I'm new to both). When I run the webpack-dev-server compilation goes fine but content from my imported module isn't working. Here is how I configure my ...
Francesco's user avatar
  • 1,792
3 votes
2 answers
1k views

Event capture on mithril?

is there no event capturing? Id like to force event handling order, in autocomplete component, onblur event fires before onclick on item in a list, causing the list to toggle twice and so remaining ...
janat08's user avatar
  • 1,767
0 votes
1 answer
306 views

How to encapsulate state with an update method and a mithril component

I want to render state that is updated every request animation frame. I want to encapsulate state with an update method and corresponding component: But that fails because it's not correct usage of ...
eguneys's user avatar
  • 6,366
0 votes
1 answer
252 views

share data between two files through es6 class in mithril js or share instance of es6 class

I want to share data between two files in mithril js Im using webpack for module loading I have this class , Im getting data from ajax request and then storing it in class member given below. import ...
Asad's user avatar
  • 3,160
0 votes
2 answers
832 views

load json file before app startup and save it in global variable mithrilJs

I want to load a JSON file into my mithrilJs app before its startup and want to save this data in some global variable (JSON file is for some run time configuration of mithril application just like ...
Asad's user avatar
  • 3,160

1
2 3 4 5 6