当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript mithril.render函数代码示例

本文整理汇总了TypeScript中mithril.render函数的典型用法代码示例。如果您正苦于以下问题:TypeScript render函数的具体用法?TypeScript render怎么用?TypeScript render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了render函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

	const run = () => {
		cells = cells === full ? empty : full;

		m.render(root, [view()]);

		setTimeout(run, 2000);
	};
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:7,代码来源:test-api.ts

示例2: function

	const run = function() {
		cells = cells === full ? empty : full

		m.render(root, [view()])

		setTimeout(run, 2000)
	}
开发者ID:cronon,项目名称:DefinitelyTyped,代码行数:7,代码来源:test-api.ts

示例3: handler

	console.assert(vnode.children![0].tag === 'div');
}

{
	const handler = m.withAttr("value", (value) => {});
	handler({currentTarget: {value: 10}});
}

{
	const params = m.parseQueryString("?a=1&b=2");
	const query = m.buildQueryString({a: 1, b: 2});
}

{
	const root = window.document.createElement("div");
	m.render(root, m("div"));
	console.assert(root.childNodes.length === 1);
}

{
	const root = window.document.createElement("div");
	m.mount(root, { view: () => m("div") });
	console.assert(root.childNodes.length === 1);
	console.assert(root.firstChild!.nodeName === "DIV");
}

{
	const root = window.document.createElement("div");
	m.route(root, "/a", {
		"/a": { view: () => m("div") }
	});
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:31,代码来源:test-api.ts

示例4: redraw

 function redraw() {
   m.render(mountPoint, Vnode(RouteComponent, undefined, undefined, undefined, undefined, undefined));
 }
开发者ID:ornicar,项目名称:lichobile,代码行数:3,代码来源:router.ts

示例5: require

import { createEditor } from '../editor'
import { createPopupmenu } from '../popupmenu'

require('codemirror/addon/hint/show-hint.js')
require('codemirror/addon/search/searchcursor.js')
require('codemirror/addon/dialog/dialog.js')
require('codemirror/keymap/sublime.js')
require('codemirror/mode/sql/sql.js')
require('../../modules/sql-hint')

const pubsub = new EventEmitter()
const editor = createEditor(m, pubsub, CodeMirror)

const editorContainer = document.createElement('div')
document.body.appendChild(editorContainer)
m.render(editorContainer, editor.view())

describe('editor', () => {
    it('should set value', () => {
        editor.setValue('testing\nline2')
        expect(editor.getValue(' ')).to.equal('testing line2')
    })

    it('should get the selected statement', () => {
        editor.setValue('line1\nline2')
        editor.setCursor({
            line: 1,
            ch: 0,
        })
        expect(editor.getCursorStatement(' ')).to.equal('line1 line2')
        editor.setValue('line1\n\nline2')
开发者ID:jakobrun,项目名称:gandalf,代码行数:31,代码来源:editor.ts


注:本文中的mithril.render函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。