本文整理汇总了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
});