Questions tagged [mithril.js]

Mithril.js is a client-side MVC framework.

Mithril.js is a client-side MVC framework - a tool to organize code in a way that is easy to think about and to maintain.

Some features include

  • Safe-by-default templates
  • Hierarchical MVC via components
  • Virtual DOM diffing and compilable templates
  • Intelligent auto-redrawing system

Official page and resources: http://mithril.js.org/

260 questions
2
votes
1 answer

How to detect model parameter change event in mithril.js?

I recently started learning mithril.js and I'm wondering how can I make very basic Model -> View one way data binding app. TestModel = function(data){ this.name = m.prop(data.name) } testModel = new TestModel({name: "John"}) code above declare a…
suish
  • 3,253
  • 1
  • 15
  • 34
2
votes
2 answers

Polymer 1.0 and external DOM manipulation library

I want to know how to modify Polymer 1.0 tags after creation via jQuery or virtual DOM. I am trying Polymer 1.0 with Mithril.js. Polymer 0.5.5 has Shadow DOM and its tag literal and internal structure (on Chrome's inspector) are almost same. But 1.0…
Yoshiki Shibukawa
  • 4,739
  • 1
  • 13
  • 8
2
votes
2 answers

How to replace jquery with the mithril equivalent?

Something like : peer.on('open', function(id){ // this is a non jquery event listener $('#pid').text(id); }); With something like...this is not correct: peer.on('open', function(id){ m('#pid',[id]) }); Is this even the right approach? Should…
jmunsch
  • 22,771
  • 11
  • 93
  • 114
2
votes
2 answers

Mithril redraw only 1 module

If I have like 10 m.module on my page, can I call m.startComputation, m.endComputation, m.redraw or m.request for only one of those modules? It looks like any of these will redraw all of my modules. I know only module 1 will be affected by some…
Farzher
  • 13,934
  • 21
  • 69
  • 100
2
votes
1 answer

How can I unit test a view with a view-model dependency in Mithril?

I am wondering how I would unit test the view in the following code: require('mithril'); var practice = {}; practice.vm = { init: function() { this.modules = [ { name: '1' }, { name: '2' }, { name: '3' } ] …
jrh
  • 4,101
  • 2
  • 22
  • 27
2
votes
2 answers

ReferenceError from within Mithril promise chain is being silently ignored

I am using Firefox 32 and Chrome 37 with Mithril.js and have now been repeatedly tripped up by typos in variable names just silently causing the JS to stop executing at the point of the reference. It's particularly frustrating for me coming from C…
Lawrence Dol
  • 63,018
  • 25
  • 139
  • 189
2
votes
2 answers

Mithril with angularjs

I am a newbie to Mithril JS framework and trying to integrate Mitril view with angularJS. Has anyone tried this before? I want to check how can we bind the angular controller methods to click events of elements created in Mitril. I got this working…
Saravanan S
  • 1,021
  • 1
  • 10
  • 24
2
votes
2 answers

Why is m.module not causing my view to rerender in Mithril?

I thought that given an object with controller & view properties, when the controller's state changed (or an m.prop property was changed) it would rerender the template. This isn't happening in my case (I have to use redraw directly). What am I…
1
vote
0 answers

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 codebase uses several style sheets, and I believe the…
Rick Ansay
  • 11
  • 3
1
vote
1 answer

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 (single page app) works as intended: it plays the…
1
vote
2 answers

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 it using the same function and so on for their…
1
vote
1 answer

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 application will create a renderer using WebGL,…
Bussiere
  • 500
  • 13
  • 60
  • 119
1
vote
0 answers

Mithrill Error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'

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 { "dependencies": { "browserify": "^17.0.0", …
Adina
  • 149
  • 6
1
vote
2 answers

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) => { return m("button", { …
1
vote
1 answer

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.attrs.articleid } } m.route(document.body,…
pr0mpT_07
  • 161
  • 1
  • 11