當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。