當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript frame.topmost函數代碼示例

本文整理匯總了TypeScript中tns-core-modules/ui/frame.topmost函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript topmost函數的具體用法?TypeScript topmost怎麽用?TypeScript topmost使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了topmost函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test_frame_retrieval_API_when_navigating

export function test_frame_retrieval_API_when_navigating() {
    const rootView = getRootView();

    const initialFrame = new Frame();
    initialFrame.id = "initialFrame";
    initialFrame.navigate(() => new Page());

    const initialTopmost = topmost();
    const initialFrameById = getFrameById("initialFrame");

    TKUnit.assertEqual(initialTopmost, initialFrame);
    TKUnit.assertEqual(initialFrameById, initialFrame);

    const newFrame = new Frame();
    newFrame.id = "newFrame";
    newFrame.navigate(() => new Page());

    const newTopmost = topmost();
    const newFrameById = getFrameById("newFrame");

    TKUnit.assertEqual(newTopmost, newFrame);
    TKUnit.assertEqual(newFrameById, newFrame);

    initialFrame.navigate(() => new Page());

    const previousTopmost = topmost();
    const previousFrameById = getFrameById("initialFrame");

    TKUnit.assertEqual(previousTopmost, initialFrame);
    TKUnit.assertEqual(previousFrameById, initialFrame);

    // clean up the frame stack
    initialFrame._removeFromFrameStack();
    newFrame._removeFromFrameStack();
}
開發者ID:qbert,項目名稱:NativeScript,代碼行數:35,代碼來源:frame-tests-common.ts

示例2: actionBarSetStatusBarStyle

export function actionBarSetStatusBarStyle(style: number) {
	if (topmost().ios) {
		const navigationBar = topmost().ios.controller.navigationBar;
		// 0: default
		// 1: light
		navigationBar.barStyle = style;
	}
}
開發者ID:TheOriginalJosh,項目名稱:nativescript-swiss-army-knife,代碼行數:8,代碼來源:actionBarSetStatusBarStyle.ts

示例3: actionBarHideBackButton

export function actionBarHideBackButton() {
	if (topmost().ios) {
		topmost().ios.controller.visibleViewController.navigationItem.setHidesBackButtonAnimated(
			true,
			false
		);
	}
}
開發者ID:TheOriginalJosh,項目名稱:nativescript-swiss-army-knife,代碼行數:8,代碼來源:actionBarHideBackButton.ts

示例4: actionBarClearButtons

export function actionBarClearButtons() {
	const actionBar = topmost().currentPage.actionBar;
	const actionItems = actionBar.actionItems.getItems();
	actionItems.forEach(item => {
		actionBar.actionItems.removeItem(item);
	});
}
開發者ID:TheOriginalJosh,項目名稱:nativescript-swiss-army-knife,代碼行數:7,代碼來源:actionBarClearButtons.ts

示例5: navigate

export function navigate(args: observable.EventData) {
    var tag = "" + args.object.get("tag");
    __startCPUProfiler("xml-performance-" + tag);
    frame.topmost().navigate({
        moduleName: tag,
    });
}
開發者ID:NathanWalker,項目名稱:NativeScript,代碼行數:7,代碼來源:start.ts

示例6: resetMaury

 resetMaury(args) {
   const img = topmost().getViewById('imageTwo') as Image;
   img.src = null;
   setTimeout(() => {
     img.src = '~/images/maury.jpg';
   }, 100);
 }
開發者ID:bradmartin,項目名稱:nativescript-image-filters,代碼行數:7,代碼來源:main-view-model.ts

示例7: resetBart

 resetBart(args) {
   const img = topmost().getViewById('imageOne') as Image;
   img.src = null;
   setTimeout(() => {
     img.src = '~/images/bart.png';
   }, 100);
 }
開發者ID:bradmartin,項目名稱:nativescript-image-filters,代碼行數:7,代碼來源:main-view-model.ts

示例8: showReportPage

function showReportPage(finalMessage: string) {
    const stack = new StackLayout();
    const btn = new Button();
    btn.text = "Rerun tests";
    btn.on("tap", () => runAll(testsSelector));
    stack.addChild(btn);

    const messageContainer = new TextView();
    messageContainer.editable = messageContainer.autocorrect = false;
    messageContainer.text = finalMessage;
    stack.addChild(messageContainer);

    topmost().navigate({
        create: () => {
            const page = new Page();
            page.content = stack;
            messageContainer.focus();
            page.style.fontSize = 11;
            if (platform.isAndroid) {
                page.on('navigatedTo', () => {
                    messageContainer.focus();
                    setTimeout(() => messageContainer.dismissSoftInput());
                });
            }

            return page;
        },
        clearHistory: true
    });
}
開發者ID:slavchev,項目名稱:NativeScript,代碼行數:30,代碼來源:testRunner.ts

示例9: test_page_parent_when_navigate_with_clear_history

export function test_page_parent_when_navigate_with_clear_history() {
    const frame = topmost();

    const pages = new Array<Page>();
    const create = () => {
        const page = new Page();
        pages.push(page);
        return page;
    };

    frame.navigate({ create });
    frame.navigate({ create, backstackVisible: false });
    frame.navigate({ create });
    frame.navigate({ create: () => new Page(), clearHistory: true });
    TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty(), NAV_WAIT);

    TKUnit.assertEqual(pages.length, 3);
    TKUnit.assertEqual(frame.backStack.length, 0);
    pages.forEach(p => {
        TKUnit.assertNull(p.parent);
        TKUnit.assertNull(p.frame);
    });

    pages.length = 0;
}
開發者ID:qbert,項目名稱:NativeScript,代碼行數:25,代碼來源:frame-tests-common.ts

示例10: test_Transitions

export function test_Transitions() {
    const topmost = topmostFrame();
    const mainTestPage = topmost.currentPage;
    const mainPageFactory = function (): Page {
        return mainTestPage;
    };

    helper.navigate(() => {
        const page = new Page();
        page.id = "TransitionsTestPage_MAIN"
        page.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
        return page;
    });

    var transitions;
    if (platform.device.os === platform.platformNames.ios) {
        transitions = ["curl"];
    } else {
        const _sdkVersion = parseInt(platform.device.sdkVersion);
        transitions = _sdkVersion >= 21 ? ["explode"] : [];
    }

    transitions = transitions.concat(["fade", "slide"]);

    // Custom transition
    _testTransition({ instance: new CustomTransition(), duration: 10 });

    // Built-in transitions
    transitions.forEach(name => {
        _testTransition({ name, duration: 20, curve: AnimationCurve.easeIn });
    });

    // helper.navigateWithEntry({ create: mainPageFactory, clearHistory: true, animated: false });
}
開發者ID:NathanWalker,項目名稱:NativeScript,代碼行數:34,代碼來源:transition-tests.ts


注:本文中的tns-core-modules/ui/frame.topmost函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。