本文整理匯總了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();
});
示例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);
});
}
示例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);
});
示例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);
});
}
}
示例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
});