[英]NativeScript Typings
I'm working through the NativeScript getting started tutorial in TypeScript: http://developer.telerik.com/featured/getting-started-nativescript/ 我正在研究TypeScript中的NativeScript入门教程: http : //developer.telerik.com/featured/getting-started-nativescript/
In one snippet of code, I see: 在一段代码中,我看到:
exports.loadSignUpView = function(args) {
page = args.object;
page.bindingContext = journeyInfo;
}
After some research I was able to type args as 经过一些研究,我能够将args键入为
import app = require("application");
exports.loadSignUpView = function(args: app.ApplicationEventData) {
//...
}
But that still does not help me type the page object above, which has the bindingContext property. 但这仍然不能帮助我在上面键入具有bindingContext属性的页面对象。 What is the TypeScript type that corresponds to the page?
与页面对应的TypeScript类型是什么?
Page type is defined in the "ui/page" module and the type of the args of the loaded
event is EventData (from the "data/observable" module). 页面类型在“ ui / page”模块中定义,已
loaded
事件的args类型为EventData(来自“ data / observable”模块)。 So you can do something like this: 因此,您可以执行以下操作:
import observable = require("data/observable");
import pages = require("ui/page");
// Event handler for Page "loaded" event attached in main-page.xml
export function loadSignUpView (args: observable.EventData) {
// Get the event sender
var page = <pages.Page>args.object;
}
Few more useful tips to get you started: 一些更有用的技巧可以帮助您入门:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.