• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript mithril.route函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initializeRouter

export function initializeRouter() {
  route.prefix('');

  const container = document.querySelector('#container');
  route(container, '/', {
    '/': { onmatch: getRooms, render: HomePage }
  });
}
开发者ID:vdsabev,项目名称:betahaus-sofia-office-manager,代码行数:8,代码来源:router.ts


示例2:

        pubsub.on('connected', connection => {
            document.body.className =
                'theme--' + (connection.settings().theme || 'dark-orange')

            connected = true
            document.title =
                'Gandalf - connected to ' + connection.settings().name
            m.route('/sql/' + connection.settings().name)
        })
开发者ID:jakobrun,项目名称:gandalf,代码行数:9,代码来源:main.ts


示例3: default

					},
					"Click me"
				)
			];
		}
	};
}

///////////////////////////////////////////////////////////
//
// Test that all are mountable components
//
m.route(document.body, '/', {
	'/comp0': comp0,
	'/comp1': comp1,
	'/comp2': comp2,
	'/comp3': comp3,
	'/comp4': comp4,
	'/comp5': comp5
});

///////////////////////////////////////////////////////////
//
// Concise module example with default export
//
interface Attrs {
	name: string;
}

export default (): Component<Attrs, {}> => {
	const count = 0;
	return {
开发者ID:DenisCarriere,项目名称:DefinitelyTyped,代码行数:32,代码来源:test-factory-component.ts


示例4: pagify

      for (const page of adminPages) {
        if (window.authorizer.hasAccess(page, 2)) {
          m.route.set(`/admin/${page}`);
          return null;
        }
      }
      return null;
    }
  };
  return component;
}

m.route(document.body, "/overview", {
  "/login": pagify("login", loginPage),
  "/overview": pagify("overview", overviewPage),
  "/devices": pagify("devices", devicesPage),
  "/devices/:id": pagify("devices", devicePage),
  "/faults": pagify("faults", faultsPage),
  "/admin": redirectAdminPage(),
  "/admin/presets": pagify("presets", presetsPage),
  "/admin/provisions": pagify("provisions", provisionsPage),
  "/admin/virtualParameters": pagify(
    "virtualParameters",
    virtualParametersPage
  ),
  "/admin/files": pagify("files", filesPage),
  "/admin/config": pagify("config", configPage),
  "/admin/users": pagify("users", usersPage),
  "/admin/permissions": pagify("permissions", permissionsPage)
});
开发者ID:zaidka,项目名称:genieacs,代码行数:30,代码来源:app.ts


示例5: createSplitter

    .then(settings => {
        const splitter = createSplitter(m)

        const pubsub = new EventEmitter()
        createGlobalShortcuts(pubsub)
        createCommitControl(pubsub)
        const errorHandler = createErrorHandler(m)
        const loginModule = createLoginModule(m, pubsub, connect, settings)
        const actions = createActions(m, pubsub, createPopupmenu)
        const tableSearch = createTableSearch(m, pubsub, createPopupmenu)
        const statusbar = createStatusbar(m, pubsub)
        const editor = createEditor(m, pubsub, CodeMirror)
        const result = createResult(m, pubsub)
        const editConnection = createEditConnection(m, pubsub, settings)
        const bookmarkModule = createBookmarkModel(
            m,
            fs,
            pubsub,
            editor,
            createPopupmenu
        )
        const historyModule = createHistoryView(
            m,
            pubsub,
            createPopupmenu,
            getHistoryModel
        )
        const columnsPrompt = createColumnsPrompt(
            m,
            editor,
            getTables,
            pubsub,
            createPopupmenu
        )
        let connected = false

        window.addEventListener(
            'beforeunload',
            () => {
                pubsub.emit('disconnect')
            },
            false
        )

        createExecuter(pubsub, editor, m)
        createSchemaHandler(fs, pubsub)
        createSqlHint(pubsub, editor, getTables, CodeMirror)

        pubsub.on('new-window', () => {
            console.log('emit new-window')
            ipcRenderer.send('new-window')
        })

        pubsub.on('connected', connection => {
            document.body.className =
                'theme--' + (connection.settings().theme || 'dark-orange')

            connected = true
            document.title =
                'Gandalf - connected to ' + connection.settings().name
            m.route('/sql/' + connection.settings().name)
        })

        function Controller() {
            const connName = m.route.param('conn')
            if (!connected && connName) {
                const connSettings = settings.connections.find(
                    c => c.name === connName
                )
                if (connSettings && connSettings.host === 'hsql:inmemory') {
                    console.log('reconnect to hsql:inmemory!!')
                    connect(
                        { host: connSettings.host },
                        connSettings
                    ).then(connection => {
                        pubsub.emit('connected', connection)
                    })
                } else {
                    pubsub.emit('login')
                }
            }
        }
        const sqlModule = {
            controller: Controller,
            view() {
                return [
                    loginModule.view(),
                    editor.view(),
                    splitter(),
                    result.view(),
                    statusbar.view(),
                    actions.view(),
                    tableSearch.view(),
                    bookmarkModule.view(),
                    historyModule.view(),
                    columnsPrompt.view(),
                    errorHandler.view(),
                    editConnection.view(),
                ]
            },
//.........这里部分代码省略.........
开发者ID:jakobrun,项目名称:gandalf,代码行数:101,代码来源:main.ts


示例6: m

	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") }
	});

	setTimeout(() => {
		console.assert(root.childNodes.length === 1);
		console.assert(root.firstChild!.nodeName === "DIV");
	}, FRAME_BUDGET);
}

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


示例7: BudgetContext

        m.startComputation();
        context.loadData(data);
        m.endComputation();
    });
} else {
    let storedBudgetData = localStorage.getItem(budgetDataKey) || "";
    context = new BudgetContext(storedBudgetData);
}

let menu = new Menu.MenuComponent([
    new Menu.BasicMenuItem(new RegExp("expenses"), `/expenses/${DF.formatDateForUrl(moment())}`, "Expenses"),
    new Menu.BasicMenuItem(new RegExp("rates"), `/rates/${DF.formatDateForUrl(moment())}`, "Rates"),
    new Menu.DropdownMenuItem(new RegExp("summary"), "Summary",
        [
            new Menu.BasicMenuItem(new RegExp("weekly"), `/summary/${DF.formatDateForUrl(moment())}/weekly`, "Weekly"),
            new Menu.BasicMenuItem(new RegExp("categories"), `/summary/${DF.formatDateForUrl(moment())}/categories`, "By Category"),
        ])
]);

let pageModel = new PageModel(root, context, fileDialog, fileNameKey, storedFileName);

let page = Page.bind(null, pageModel, menu);

m.route.mode = "search";

m.route(root, `/expenses/${DF.formatDateForUrl(moment())}`, {
    "/rates/:date": new page(new RatesComponent(context)),
    "/expenses/:date": new page(new ExpenseComponent(context)),
    "/summary/:date/:type": new page(new SummaryComponent(context)),
    "/categories": new page(new CategoryComponent(context))
});
开发者ID:AlexanderLindsay,项目名称:dailybudgeteer,代码行数:31,代码来源:start.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript mithril.startComputation函数代码示例发布时间:2022-05-25
下一篇:
TypeScript mithril.request函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap