當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript sidewalk.Sidewalk類代碼示例

本文整理匯總了TypeScript中sidewalk.Sidewalk的典型用法代碼示例。如果您正苦於以下問題:TypeScript Sidewalk類的具體用法?TypeScript Sidewalk怎麽用?TypeScript Sidewalk使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Sidewalk類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

window.addEventListener('bubblegum.loaded', function() {

	Sidewalk.registerRoute({
		name: 'index',
		url: '/',
		onLoad: function(data) {
			Index.run();
		}
	});

	Sidewalk.registerRoutes({
		urls: [
			{
				name: "sections",
				url: "/sections",
				onLoad: function(data) {
					console.log('sections');
				}
			},
			{
				name: "sections.edit",
				url: "/sections/edit",
				onLoad: function(data) {
					console.log('edit');
				}
			},
			{
				name: "sections.search",
				url: "/sections/search",
				onLoad: function(data) {
					console.log('search');
				}
			},
			{
				name: "sections.remove",
				url: "/sections/remove",
				onLoad: function(data) {
					console.log('remove');
				}
			},
			{
				name: "sections.add",
				url: "/sections/add",
				onLoad: function(data) {
					console.log('add');
				}
			},
			{
				name: "sections.id",
				url: "/sections/(:number)",
				onLoad: function(data) {
					console.log('loading sections.id');
					Sections.run(data);
				}
			}
	]
	});

	Sidewalk.run();
});
開發者ID:Gyunu,項目名稱:Bubblegum,代碼行數:60,代碼來源:index.ts

示例2: run

	export function run(id) {
		let listitems = [];
		let sectionsModel = Sidewalk.getModel('sections');
		console.log(sectionsModel);
		sectionsModel.getId(function(id, data) {
			console.log('model data');
			console.log(data);
		});
	}
開發者ID:Gyunu,項目名稱:Bubblegum,代碼行數:9,代碼來源:sections.ts

示例3: function

			data.forEach(function(item) {
				let litem = Sidewalk.getComponent('listitem').attachTo(document.querySelectorAll('.list')[0]);
				//TODO expose these properties on the controller, i made the msitage of doing it on the controller so its not obvious and i wrote the fucker
				litem.template.title = item.name;
				litem.template.count = item.entries;
				litem.template.id = item.id;
				litem.render();
				litem.on('click', function(e) {
					
				});

				listitems.push(litem);
			});
開發者ID:Gyunu,項目名稱:Bubblegum,代碼行數:13,代碼來源:index.ts

示例4: require

/*jslint node: true */
/*jslint white: true */
"use strict";

declare function require (id: string): any;
var Sidewalk = require('sidewalk').Sidewalk;
// var actionbarTemplate = require("html!../templates/actionbar.html");
// var sectionlistTemplate = require("html!../templates/sectionlist.html");
// var sectionlistItemTemplate = require("html!../templates/sectionlistitem.html");

export module Sections {

	Sidewalk.registerModel({
		name: "sections",
		root: "sections",
		urls: {
			"all": "(:all)",
			"id": "(:id)"
		}
	});

	export function run(id) {
		let listitems = [];
		let sectionsModel = Sidewalk.getModel('sections');
		console.log(sectionsModel);
		sectionsModel.getId(function(id, data) {
			console.log('model data');
			console.log(data);
		});
	}

}
開發者ID:Gyunu,項目名稱:Bubblegum,代碼行數:32,代碼來源:sections.ts

示例5: require

/*jslint node: true */
/*jslint white: true */
"use strict";

declare function require (id: string): any;
var Sidewalk = require('sidewalk').Sidewalk;
var actionbarTemplate = require("html!../templates/actionbar.html");
var sectionlistTemplate = require("html!../templates/sectionlist.html");
var sectionlistItemTemplate = require("html!../templates/sectionlistitem.html");

export module Index {

	Sidewalk.registerModel({
		name: "sections",
		root: "sections",
		urls: {
			"all": "(:all)",
			"id": "(:id)"
		}
	});

	Sidewalk.registerComponent({
		name: 'list',
		template: sectionlistTemplate,
	});

	//TODO sort out using
	Sidewalk.registerComponent({
		name: 'listitem',
		template: sectionlistItemTemplate
	});
開發者ID:Gyunu,項目名稱:Bubblegum,代碼行數:31,代碼來源:index.ts


注:本文中的sidewalk.Sidewalk類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。