How to use the mithril.redraw function in mithril

To help you get started, we’ve selected a few mithril examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tutao / tutanota / src / gui / base / BubbleTextField.js View on Github external
// if there is a selected suggestion, we shall create a bubble from that suggestions instead of the entered text
		if (this.selectedSuggestion != null) {
			let bubble = this.bubbleHandler.createBubbleFromSuggestion(this.selectedSuggestion)
			if (bubble) {
				this.bubbles.push(bubble)
				this.textField.value("")
			}
		} else {
			let bubbles = this.bubbleHandler.createBubblesFromText(value)
			if (bubbles.length > 0) {
				this.bubbles.push(...bubbles)
				this.textField.value("")
			}
		}
		m.redraw()
		return false //TODO: explain
	}
github vrimar / construct-ui / src / components / form / examples / index.ts View on Github external
setTimeout(() => {
      this.isSubmitting = false;
      m.redraw();

      const target = e.target as HTMLFormElement;
      const inputs = target.elements;
      const values = {};

      for (let i = 0; i < inputs.length; i++) {
        const input = inputs[i] as HTMLInputElement;
        values[input.name] = input.value;
      }

      alert(JSON.stringify(values));
    }, 500);
  }
github catarse / catarse.js / src / c / project-successful-onboard.js View on Github external
actionSource: () => {
                              showTaxModal.toggle();
                              m.redraw();
                          }
                      }
github tutao / tutanota / src / calendar / CalendarEventDialog.js View on Github external
const parsedStartTime = parseTime(startTime())
		const parsedEndTime = parseTime(endTime())
		if (!parsedStartTime || !parsedEndTime || !parsedOldStartTime) {
			return
		}
		const endTotalMinutes = parsedEndTime.hours * 60 + parsedEndTime.minutes
		const startTotalMinutes = parsedStartTime.hours * 60 + parsedStartTime.minutes
		const diff = Math.abs(endTotalMinutes - parsedOldStartTime.hours * 60 - parsedOldStartTime.minutes)
		const newEndTotalMinutes = startTotalMinutes + diff
		let newEndHours = Math.floor(newEndTotalMinutes / 60)
		if (newEndHours > 23) {
			newEndHours = 23
		}
		const newEndMinutes = newEndTotalMinutes % 60
		endTime(timeStringFromParts(newEndHours, newEndMinutes, amPmFormat))
		m.redraw()
	}
github catarse / catarse / catarse.js / legacy / src / root / projects / edit / rewards-edit-list.tsx View on Github external
reader.onload = function () {
                imageFileToUpload(imageInputElementFile);
                var dataURL = reader.result;
                reward.uploaded_image(dataURL);
                m.redraw();
            };
            reader.readAsDataURL(imageInputElementFile);
github tivac / crucible / src / pages / listing / index.js View on Github external
function onSearchResults(searchStr, snap) {
        var contents = contentFromSnapshot(snap);

        ctrl.results = contents.filter(function(content) {
            return fuzzy(searchStr, content.search);
        });

        return m.redraw();
    }
github tutao / tutanota / src / settings / WhitelabelSettingsViewer.js View on Github external
let items = [{name: lang.get("deactivated_label"), value: null}]
				items = items.concat(customerInfo.domainInfos.filter(d => !d.certificate).map(d => {
					return {name: d.domain, value: d.domain}
				}))
				let initialValue = (props.whitelabelRegistrationDomains.length
					=== 0) ? null : props.whitelabelRegistrationDomains[0].value
				this._whitelabelRegistrationDomains = new DropDownSelector("whitelabelRegistrationEmailDomain_label", null, items, stream(initialValue), 250).setSelectionChangedHandler(v => {
					props.whitelabelRegistrationDomains.length = 0
					if (v) {
						let domain = createStringWrapper()
						domain.value = v
						props.whitelabelRegistrationDomains.push(domain)
					}
					update(props)
				})
				m.redraw()
			})
		})
github TwoRavens / TwoRavens / assets / EventData / app / subsets / Actor.js View on Github external
updateAll();
    }

    let diagramWidth = actorLinkDiv.width();
    actorSVG.attr("width", diagramWidth);

    actorWidth = actorSVG.node().getBoundingClientRect().width;
    boundaryLeft = Math.floor(actorWidth / 2) - 20;     //max x coordinate source nodes can move
    boundaryRight = Math.ceil(actorWidth / 2) + 20;     //max x coordinate target nodes can move

    d3.select("#centerLine").attr("d", function () {
        return "M" + diagramWidth / 2 + "," + 0 + "V" + actorHeight;
    });
    updateAll();

    redraw && m.redraw();
}
github tutao / tutanota / src / login / LoginView.js View on Github external
_showLoginForm(mailAddress: string) {
		this.mailAddress.value(mailAddress)
		this._isDeleteCredentials = false;
		this._showingKnownCredentials = false;
		m.redraw()
	}
github ArthurClemens / mithril-slider / packages / mithril-slider / src / index.js View on Github external
const setIndex = idx => {
    const oldIndex = index();
    if (oldIndex !== idx) {
      index(idx);
      m.redraw();
      if (attrs.getState) {
        const el = contentEl;
        const page = getPageEl(el, index());
        attrs.getState({
          index: idx,
          hasNext: hasNext(),
          hasPrevious: hasPrevious(),
          pageEl: page
        });
      }
    }
  };