mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Intermediate commit, using the NavBar items push/pop/set.
This commit is contained in:
@@ -3,6 +3,7 @@ import definition = require("application");
|
||||
import fs = require("file-system");
|
||||
import styleScope = require("ui/styling/style-scope");
|
||||
import observable = require("data/observable");
|
||||
import frame = require("ui/frame");
|
||||
|
||||
var events = new observable.Observable();
|
||||
global.moduleMerge(events, exports);
|
||||
@@ -15,6 +16,9 @@ export var lowMemoryEvent = "lowMemory";
|
||||
export var uncaughtErrorEvent = "uncaughtError";
|
||||
export var orientationChangedEvent = "orientationChanged";
|
||||
|
||||
export var mainModule: string;
|
||||
export var mainEntry: frame.NavigationEntry;
|
||||
|
||||
export var cssFile: string = "app.css"
|
||||
|
||||
export var resources: any = {};
|
||||
|
||||
@@ -7,8 +7,6 @@ import enums = require("ui/enums");
|
||||
|
||||
global.moduleMerge(appModule, exports);
|
||||
|
||||
export var mainModule: string;
|
||||
|
||||
// We are using the exports object for the common events since we merge the appModule with this module's exports, which is what users will receive when require("application") is called;
|
||||
// TODO: This is kind of hacky and is "pure JS in TypeScript"
|
||||
|
||||
@@ -218,10 +216,15 @@ export class AndroidApplication extends observable.Observable implements dts.And
|
||||
|
||||
var topFrame = frame.topmost();
|
||||
if (!topFrame) {
|
||||
// try to navigate to the mainModule (if specified)
|
||||
if (mainModule) {
|
||||
// try to navigate to the mainEntry/Module (if specified)
|
||||
var navParam = dts.mainEntry;
|
||||
if (!navParam) {
|
||||
navParam = dts.mainModule;
|
||||
}
|
||||
|
||||
if (navParam) {
|
||||
topFrame = new frame.Frame();
|
||||
topFrame.navigate(mainModule);
|
||||
topFrame.navigate(navParam);
|
||||
} else {
|
||||
// TODO: Throw an exception?
|
||||
throw new Error("A Frame must be used to navigate to a Page.");
|
||||
|
||||
6
application/application.d.ts
vendored
6
application/application.d.ts
vendored
@@ -4,6 +4,7 @@
|
||||
declare module "application" {
|
||||
import cssSelector = require("ui/styling/css-selector");
|
||||
import observable = require("data/observable");
|
||||
import frame = require("ui/frame");
|
||||
|
||||
/**
|
||||
* An extended JavaScript Error which will have the nativeError property initialized in case the error is caused by executing platform-specific code.
|
||||
@@ -94,6 +95,11 @@ declare module "application" {
|
||||
*/
|
||||
export var mainModule: string;
|
||||
|
||||
/**
|
||||
* The main navigation entry to be used when loading the main Page.
|
||||
*/
|
||||
export var mainEntry: frame.NavigationEntry;
|
||||
|
||||
/**
|
||||
* An application level static resources.
|
||||
*/
|
||||
|
||||
@@ -5,9 +5,8 @@ import types = require("utils/types");
|
||||
import view = require("ui/core/view");
|
||||
import definition = require("application");
|
||||
import enums = require("ui/enums");
|
||||
global.moduleMerge(appModule, exports);
|
||||
|
||||
export var mainModule: string;
|
||||
global.moduleMerge(appModule, exports);
|
||||
|
||||
class Responder extends UIResponder {
|
||||
//
|
||||
@@ -120,13 +119,18 @@ class IOSApplication implements definition.iOSApplication {
|
||||
|
||||
var topFrame = frame.topmost();
|
||||
if (!topFrame) {
|
||||
if (mainModule) {
|
||||
// try to navigate to the mainEntry/Module (if specified)
|
||||
var navParam = definition.mainEntry;
|
||||
if (!navParam) {
|
||||
navParam = definition.mainModule;
|
||||
}
|
||||
|
||||
if (navParam) {
|
||||
topFrame = new frame.Frame();
|
||||
topFrame.navigate(mainModule);
|
||||
topFrame.navigate(navParam);
|
||||
} else {
|
||||
// TODO: Throw an exception?
|
||||
// throw new Error("A Frame must be used to navigate to a Page.");
|
||||
return;
|
||||
throw new Error("A Frame must be used to navigate to a Page.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user