nativescript

How debug nativescript code?

别来无恙 提交于 2019-12-20 06:38:18
问题 I am just starting out with nativescript so please mind if this is just a simple question. I run my code on my phone with tns run android but when it starts it starts tons of loggin also in console so how can I debug the code I have written lets say I have console.log statement in my code but I can't find my statement in that heaps of logs easily. 回答1: You can use the debugger tool, available for the JavaScript virtual machine. You can find more information about it in the NativeScript

Is it feasible to use web worker (multi-threading) in Angular and Typescript in NativeScript?

扶醉桌前 提交于 2019-12-20 05:58:43
问题 I'm currently develop an App that is based on NativeScript and Angular2. My screen freeze for while when my App fetching data through HTTP, and I'd like to put the fetching action into another thread. I did a lot of search on the web, and all I got is the code in javascript like the official doc - https://docs.nativescript.org/angular/core-concepts/multithreading-model.html Is there any way to implement the muli-threading with WebWorker in "Typescript"(which contain the support of Angular

In NativeScript with Angular2 get element value

北战南征 提交于 2019-12-20 05:39:16
问题 I have a list, and I want to get the value of the list item. The view is as follows <ListView [items]="myItems" (itemTap)="onItemTap($event)"> <template let-item="item" let-i="index" let-odd="odd" let-even="even"> <StackLayout [class.odd]="odd" [class.even]="even"> <Label #myFoo id="grocery-list" [text]='"Value is: " + i'></Label> </StackLayout> </template> In typescript I have the following import { Component,ViewChild,ElementRef } from "@angular/core"; import {topmost} from "ui/frame";

Nativescript behavior of the '< Go Back' button

我的梦境 提交于 2019-12-20 05:16:39
问题 I've got the following ActionBar definition <ActionBar class="action-bar" title="Settings"> <NavigationButton text="Go Back" android.systemIcon="ic_menu_back" tap="onBackTap"/> </ActionBar> The Android version does get called. In the iOS version - the onBackTap method is never called. Also it seems in iOS version, even if the NavigationButton entry is not there, {N} inserts one automatically. 回答1: UPDATE: Indeed, it appears that the NavigationButton in iOS can only be used to navigate back

How to access component method inside my ios delegate class

被刻印的时光 ゝ 提交于 2019-12-19 12:03:12
问题 How to access a method from the app component to main.ts file?? I am developing android and ios mobile application using Nativescript angular. I have created a ios delegate class for application onResume. I want to call the native script class component method inside of my ios delegate class. Help me achieve the functionality My ios delegate class: import { android, ios, AndroidApplication, AndroidActivityBundleEventData } from "tns-core-modules/application"; import * as application from "tns

Adding a global variable / function in JavaScript (specifically NativeScript)

别等时光非礼了梦想. 提交于 2019-12-18 20:48:47
问题 I'm learning how to write apps with NativeScript. I believe the best way to learn is by doing. For that reason, I'm building a basic app. In this app, I'm trying to create a function and a variable that I can access across ALL of the view models and other code in the app. In an attempt to do this, I thought I would add a function and variable on the application object. In NativeScript, the app is initialized using the following code: app.js var application = require("application");

Swift Version NativeScript

佐手、 提交于 2019-12-18 12:38:59
问题 Using NativeScript how can I run a project under iOS? I get these messages when I run tns run iOS --bundle Webpack compilation complete. Watching for file changes. Webpack build done! Copying template files... Platform ios successfully added. v4.2.0 Executing before-shouldPrepare hook from /Users/Zian/Documents/Projects/NativeScript/Hybrid/hooks/before-shouldPrepare/nativescript-dev-webpack.js Preparing project... Executing before-prepareJSApp hook from /Users/Zian/Documents/Projects

Nativescript android remove action bar

三世轮回 提交于 2019-12-18 12:09:59
问题 I am trying to develop android app using Nativescript and try to remove Action Bar (top bar with "testns" title), but don't know how. I am using code below but not working. Currently using tns v.1.3.0 var frameModule = require("ui/frame"); exports.pageLoaded = function(){ var topmost = frameModule.topmost(); topmost.android.showActionBar = false; }; 回答1: You can explicitly control the visibility of the ActionBar by setting the actionBarHidden property of the Page , look this: import {Page}

How can I access Native api in NativeScript when I use Typescript

我与影子孤独终老i 提交于 2019-12-17 09:51:35
问题 When I create two new apps with tns, one is the regular js version and one is with typescript. I get a strange error in the typescript version when I try to access a native library. When I create a loaded function with a console.log(pow(x,y)), it works fine with the js version but the typescript version crashes with this error. error TS2304: Cannot find name 'pow'. Why? TS: import { EventData } from "data/observable"; import { Page } from "ui/page"; import { HelloWorldModel } from "./main

Using JavaScript files in NativeScript

筅森魡賤 提交于 2019-12-14 04:20:08
问题 I am learning NativeScript. As part of that, I'm trying out a basic project. In that project, I'm trying to use a JavaScript file that I use for string manipulation. This file does NOT require access to browser elements like the DOM. Yet, I can't run my app when I include the file. At this time, I have the following in my ./app/home/index.js file: var MyFile = require('../app/code/myFile.js'); ... var prefix = myFile.GetPrefix(someStringValue); For more background: I've included the file in .