mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 22:01:42 +08:00
@ -50,9 +50,9 @@ export function setUpModule() {
|
||||
|
||||
export function tearDownModule() {
|
||||
navHelper.goBack();
|
||||
delete testPage;
|
||||
delete rootLayout;
|
||||
delete tmp;
|
||||
testPage = null;
|
||||
rootLayout = null;
|
||||
tmp = null;
|
||||
}
|
||||
|
||||
export function setUp() {
|
||||
|
@ -52,9 +52,9 @@ export function setUpModule() {
|
||||
export function tearDownModule() {
|
||||
navHelper.goBack();
|
||||
|
||||
delete tmp;
|
||||
delete newPage;
|
||||
delete rootLayout;
|
||||
tmp = null;
|
||||
newPage = null;
|
||||
rootLayout = null;
|
||||
}
|
||||
|
||||
export function setUp() {
|
||||
|
@ -29,11 +29,11 @@ export function setUpModule() {
|
||||
|
||||
export function tearDownModule() {
|
||||
navHelper.goBack();
|
||||
delete tmp;
|
||||
delete newPage;
|
||||
delete rootLayout;
|
||||
delete btn1;
|
||||
delete btn2;
|
||||
tmp = null;
|
||||
newPage = null;
|
||||
rootLayout = null;
|
||||
btn1 = null;
|
||||
btn2 = null;
|
||||
}
|
||||
|
||||
export function setUp() {
|
||||
|
@ -49,9 +49,9 @@ export function setUpModule() {
|
||||
|
||||
export function tearDownModule() {
|
||||
helper.goBack();
|
||||
delete tmp;
|
||||
delete newPage;
|
||||
delete scrollView;
|
||||
tmp = null;
|
||||
newPage = null;
|
||||
scrollView = null;
|
||||
}
|
||||
|
||||
export function setUp() {
|
||||
|
@ -25,8 +25,8 @@ export function setUpModule() {
|
||||
|
||||
export function tearDownModule() {
|
||||
helper.goBack();
|
||||
delete testBtn;
|
||||
delete testPage;
|
||||
testBtn = null;
|
||||
testPage = null;
|
||||
}
|
||||
|
||||
export function tearDown() {
|
||||
|
2
data/observable/observable.d.ts
vendored
2
data/observable/observable.d.ts
vendored
@ -97,7 +97,7 @@ declare module "data/observable" {
|
||||
* Notifies all the registered listeners for the event provided in the data.eventName.
|
||||
* @param data The data associated with the event.
|
||||
*/
|
||||
notify(data: EventData): void;
|
||||
notify<T extends EventData>(data: T): void;
|
||||
|
||||
/**
|
||||
* Notifies all the registered listeners for the property change event.
|
||||
|
@ -118,7 +118,7 @@ export class Observable implements definition.Observable {
|
||||
this[data.propertyName] = data.value;
|
||||
}
|
||||
|
||||
public notify(data: definition.EventData) {
|
||||
public notify<T extends definition.EventData>(data: T) {
|
||||
var observers = this._getEventList(data.eventName);
|
||||
if (!observers) {
|
||||
return;
|
||||
|
@ -309,6 +309,12 @@ module.exports = function(grunt) {
|
||||
outDir: localCfg.outModulesDir,
|
||||
options: {
|
||||
fast: 'never',
|
||||
|
||||
// Resolve non-relative modules like "ui/styling/style"
|
||||
// based on the project root (not on node_modules which
|
||||
// is the typescript 1.6+ default)
|
||||
additionalFlags: '--moduleResolution classic',
|
||||
|
||||
module: "commonjs",
|
||||
target: "es5",
|
||||
sourceMap: false,
|
||||
|
@ -19,12 +19,12 @@
|
||||
"grunt-exec": "0.4.6",
|
||||
"grunt-multi-dest": "1.0.0",
|
||||
"grunt-shell": "1.1.2",
|
||||
"grunt-ts": "4.2.0",
|
||||
"grunt-ts": "5.0.0-beta.5",
|
||||
"grunt-tslint": "2.4.0",
|
||||
"mocha": "2.2.5",
|
||||
"grunt-simple-mocha": "0.4.0",
|
||||
"grunt-env": "0.4.4",
|
||||
"chai": "3.2.0",
|
||||
"typescript": "1.5.3"
|
||||
"typescript": "1.6.2"
|
||||
}
|
||||
}
|
||||
|
@ -272,8 +272,7 @@ export class Animation extends common.Animation implements definition.Animation
|
||||
value: Animation._affineTransform(CGAffineTransformIdentity, propertyAnimations[i].property, propertyAnimations[i].value),
|
||||
duration: propertyAnimations[i].duration,
|
||||
delay: propertyAnimations[i].delay,
|
||||
iterations: propertyAnimations[i].iterations,
|
||||
iosUIViewAnimationCurve: propertyAnimations[i].curve
|
||||
iterations: propertyAnimations[i].iterations
|
||||
};
|
||||
trace.write("Created new transform animation: " + common.Animation._getAnimationInfo(newTransformAnimation), trace.categories.Animation);
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
import view = require("ui/core/view");
|
||||
import bindable = require("ui/core/bindable");
|
||||
import types = require("utils/types");
|
||||
import definition = require("ui/builder/component-builder");
|
||||
import fs = require("file-system");
|
||||
@ -101,8 +100,6 @@ export function getComponentModule(elementName: string, namespace: string, attri
|
||||
}
|
||||
|
||||
if (instance && instanceModule) {
|
||||
var bindings = new Array<bindable.BindingOptions>();
|
||||
|
||||
for (var attr in attributes) {
|
||||
|
||||
var attrValue = <string>attributes[attr];
|
||||
@ -136,7 +133,7 @@ export function getComponentModule(elementName: string, namespace: string, attri
|
||||
}
|
||||
}
|
||||
|
||||
componentModule = { component: instance, exports: instanceModule, bindings: bindings };
|
||||
componentModule = {component: instance, exports: instanceModule};
|
||||
}
|
||||
|
||||
return componentModule;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import common = require("ui/button/button-common");
|
||||
import utils = require("utils/utils")
|
||||
|
||||
global.moduleMerge(common, exports);
|
||||
|
||||
@ -22,7 +23,8 @@ export class Button extends common.Button {
|
||||
|
||||
this._android = new android.widget.Button(this._context);
|
||||
|
||||
this._android.setOnClickListener(new android.view.View.OnClickListener({
|
||||
this._android.setOnClickListener(new android.view.View.OnClickListener(
|
||||
<utils.Owned & android.view.View.IOnClickListener>{
|
||||
get owner() {
|
||||
return that.get();
|
||||
},
|
||||
|
@ -2,6 +2,7 @@
|
||||
import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import proxy = require("ui/core/proxy");
|
||||
import types = require("utils/types");
|
||||
import utils = require("utils/utils")
|
||||
|
||||
function onYearPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
||||
var picker = <DatePicker>data.object;
|
||||
@ -78,7 +79,8 @@ export class DatePicker extends common.DatePicker {
|
||||
|
||||
var that = new WeakRef(this);
|
||||
|
||||
this._listener = new android.widget.DatePicker.OnDateChangedListener({
|
||||
this._listener = new android.widget.DatePicker.OnDateChangedListener(
|
||||
<utils.Owned & android.widget.DatePicker.IOnDateChangedListener>{
|
||||
get owner() {
|
||||
return that.get();
|
||||
},
|
||||
|
@ -1,6 +1,7 @@
|
||||
import common = require("ui/list-picker/list-picker-common");
|
||||
import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import types = require("utils/types");
|
||||
import utils = require("utils/utils")
|
||||
|
||||
global.moduleMerge(common, exports);
|
||||
|
||||
@ -28,7 +29,8 @@ export class ListPicker extends common.ListPicker {
|
||||
|
||||
var that = new WeakRef(this);
|
||||
|
||||
this._formatter = new android.widget.NumberPicker.Formatter({
|
||||
this._formatter = new android.widget.NumberPicker.Formatter(
|
||||
<utils.Owned & android.widget.NumberPicker.IFormatter>{
|
||||
get owner(): ListPicker {
|
||||
return that.get();
|
||||
},
|
||||
@ -43,7 +45,7 @@ export class ListPicker extends common.ListPicker {
|
||||
});
|
||||
this._android.setFormatter(this._formatter);
|
||||
|
||||
this._valueChangedListener = new android.widget.NumberPicker.OnValueChangeListener({
|
||||
this._valueChangedListener = new android.widget.NumberPicker.OnValueChangeListener(<utils.Owned & android.widget.NumberPicker.IOnValueChangeListener>{
|
||||
get owner() {
|
||||
return that.get();
|
||||
},
|
||||
|
@ -7,6 +7,7 @@ import proxy = require("ui/core/proxy");
|
||||
import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import color = require("color");
|
||||
import definition = require("ui/list-view");
|
||||
import utils = require("utils/utils")
|
||||
|
||||
var ITEMLOADING = common.ListView.itemLoadingEvent;
|
||||
var LOADMOREITEMS = common.ListView.loadMoreItemsEvent;
|
||||
@ -50,7 +51,7 @@ export class ListView extends common.ListView {
|
||||
var that = new WeakRef(this);
|
||||
|
||||
// TODO: This causes many marshalling calls, rewrite in Java and generate bindings
|
||||
this.android.setOnScrollListener(new android.widget.AbsListView.OnScrollListener({
|
||||
this.android.setOnScrollListener(new android.widget.AbsListView.OnScrollListener(<utils.Owned & android.widget.AbsListView.IOnScrollListener>{
|
||||
onScrollStateChanged: function (view: android.widget.AbsListView, scrollState: number) {
|
||||
var owner: ListView = this.owner;
|
||||
if (!owner) {
|
||||
|
@ -3,6 +3,7 @@ import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import proxy = require("ui/core/proxy");
|
||||
import color = require("color");
|
||||
import types = require("utils/types");
|
||||
import utils = require("utils/utils")
|
||||
|
||||
var SEARCHTEXT = "searchText";
|
||||
var QUERY = "query";
|
||||
@ -101,7 +102,7 @@ export class SearchBar extends common.SearchBar {
|
||||
this._android.setIconified(false);
|
||||
|
||||
var that = new WeakRef(this);
|
||||
this._android.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener({
|
||||
this._android.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener(<utils.Owned & android.widget.SearchView.IOnQueryTextListener>{
|
||||
get owner() {
|
||||
return that.get();
|
||||
},
|
||||
@ -132,7 +133,7 @@ export class SearchBar extends common.SearchBar {
|
||||
}
|
||||
}));
|
||||
|
||||
this._android.setOnCloseListener(new android.widget.SearchView.OnCloseListener({
|
||||
this._android.setOnCloseListener(new android.widget.SearchView.OnCloseListener(<utils.Owned & android.widget.SearchView.IOnCloseListener>{
|
||||
get owner() {
|
||||
return that.get();
|
||||
},
|
||||
|
@ -1,6 +1,7 @@
|
||||
import common = require("ui/switch/switch-common");
|
||||
import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import proxy = require("ui/core/proxy");
|
||||
import utils = require("utils/utils")
|
||||
|
||||
function onCheckedPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
||||
var swtch = <Switch>data.object;
|
||||
@ -28,7 +29,7 @@ export class Switch extends common.Switch {
|
||||
|
||||
var that = new WeakRef(this);
|
||||
|
||||
this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({
|
||||
this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener(<utils.Owned & android.widget.CompoundButton.IOnCheckedChangeListener>{
|
||||
get owner() {
|
||||
return that.get();
|
||||
},
|
||||
|
@ -1,6 +1,7 @@
|
||||
import common = require("ui/time-picker/time-picker-common");
|
||||
import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import proxy = require("ui/core/proxy");
|
||||
import utils = require("utils/utils")
|
||||
|
||||
function onHourPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
||||
var picker = <TimePicker>data.object;
|
||||
@ -32,7 +33,8 @@ export class TimePicker extends common.TimePicker {
|
||||
|
||||
var that = new WeakRef(this);
|
||||
|
||||
this._listener = new android.widget.TimePicker.OnTimeChangedListener({
|
||||
this._listener = new android.widget.TimePicker.OnTimeChangedListener(
|
||||
<utils.Owned & android.widget.TimePicker.IOnTimeChangedListener>{
|
||||
get owner() {
|
||||
return that.get();
|
||||
},
|
||||
|
9
utils/utils.d.ts
vendored
9
utils/utils.d.ts
vendored
@ -3,6 +3,15 @@
|
||||
|
||||
export var RESOURCE_PREFIX: string;
|
||||
|
||||
//@private
|
||||
/**
|
||||
* Used by various android event listener implementations
|
||||
*/
|
||||
interface Owned {
|
||||
owner: any;
|
||||
}
|
||||
//@endprivate
|
||||
|
||||
/**
|
||||
* Utility module related to layout.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user