mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
42
apps/playground/.gitignore
vendored
Normal file
42
apps/playground/.gitignore
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# NativeScript
|
||||
hooks/
|
||||
node_modules/
|
||||
platforms/
|
||||
|
||||
# NativeScript Template
|
||||
*.js.map
|
||||
*.js
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
.idea
|
||||
.cloud
|
||||
.project
|
||||
tmp/
|
||||
typings/
|
||||
|
||||
# misc
|
||||
npm-debug.log
|
||||
|
||||
# app
|
||||
!*.d.ts
|
||||
!src/assets/fontawesome.min.css
|
||||
/report/
|
||||
.nsbuildinfo
|
||||
/temp/
|
||||
/src/tns_modules/
|
||||
|
||||
# app uses platform specific scss which can inadvertently get renamed which will cause problems
|
||||
app/app.scss
|
||||
|
||||
package-lock.json
|
||||
!tools/**
|
||||
4
apps/playground/nsconfig.json
Normal file
4
apps/playground/nsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"appResourcesPath": "../../tools/assets/App_Resources",
|
||||
"appPath": "src"
|
||||
}
|
||||
23
apps/playground/package.json
Normal file
23
apps/playground/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"nativescript": {
|
||||
"id": "org.ns.testcore",
|
||||
"tns-ios": {
|
||||
"version": "6.5.0"
|
||||
},
|
||||
"tns-android": {
|
||||
"version": "6.5.0"
|
||||
}
|
||||
},
|
||||
"main": "app.js",
|
||||
"description": "NativeScript Application",
|
||||
"license": "SEE LICENSE IN <your-license-filename>",
|
||||
"repository": "<fill-your-repository-here>",
|
||||
"dependencies": {
|
||||
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core",
|
||||
"@nativescript/core": "file:../../packages/core"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
|
||||
"typescript": "file:../../node_modules/typescript"
|
||||
}
|
||||
}
|
||||
2
apps/playground/references.d.ts
vendored
Normal file
2
apps/playground/references.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference path="../../types-ios/src/lib/ios.d.ts" />
|
||||
/// <reference path="../../types-android/src/lib/android-29.d.ts" />
|
||||
2
apps/playground/src/app-root.xml
Normal file
2
apps/playground/src/app-root.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<Frame defaultPage="main-page">
|
||||
</Frame>
|
||||
21
apps/playground/src/app.css
Normal file
21
apps/playground/src/app.css
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
In NativeScript, the app.css file is where you place CSS rules that
|
||||
you would like to apply to your entire application. Check out
|
||||
http://docs.nativescript.org/ui/styling for a full list of the CSS
|
||||
selectors and properties you can use to style UI components.
|
||||
|
||||
/*
|
||||
In many cases you may want to use the NativeScript core theme instead
|
||||
of writing your own CSS rules. For a full list of class names in the theme
|
||||
refer to http://docs.nativescript.org/ui/theme.
|
||||
The imported CSS rules must precede all other types of rules.
|
||||
*/
|
||||
@import '~nativescript-theme-core/css/core.light.css';
|
||||
|
||||
/*
|
||||
The following CSS rule changes the font size of all UI
|
||||
components that have the btn class name.
|
||||
*/
|
||||
.btn {
|
||||
font-size: 18;
|
||||
}
|
||||
3
apps/playground/src/app.ts
Normal file
3
apps/playground/src/app.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Application } from '@nativescript/core';
|
||||
|
||||
Application.run({ moduleName: 'app-root' });
|
||||
7
apps/playground/src/main-page.ts
Normal file
7
apps/playground/src/main-page.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { EventData, Page } from '@nativescript/core';
|
||||
import { HelloWorldModel } from './main-view-model';
|
||||
|
||||
export function navigatingTo(args: EventData) {
|
||||
const page = <Page>args.object;
|
||||
page.bindingContext = new HelloWorldModel();
|
||||
}
|
||||
11
apps/playground/src/main-page.xml
Normal file
11
apps/playground/src/main-page.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
|
||||
<Page.actionBar>
|
||||
<ActionBar title="My App" icon="" class="action-bar">
|
||||
</ActionBar>
|
||||
</Page.actionBar>
|
||||
<StackLayout class="p-20">
|
||||
<Label text="Tap the button" class="h1 text-center"/>
|
||||
<Button text="TAP" tap="{{ onTap }}" class="btn btn-primary btn-active"/>
|
||||
<Label text="{{ message }}" class="h2 text-center" textWrap="true"/>
|
||||
</StackLayout>
|
||||
</Page>
|
||||
38
apps/playground/src/main-view-model.ts
Normal file
38
apps/playground/src/main-view-model.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Observable } from '@nativescript/core';
|
||||
|
||||
export class HelloWorldModel extends Observable {
|
||||
private _counter: number;
|
||||
private _message: string;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
// Initialize default values.
|
||||
this._counter = 42;
|
||||
this.updateMessage();
|
||||
}
|
||||
|
||||
get message(): string {
|
||||
return this._message;
|
||||
}
|
||||
|
||||
set message(value: string) {
|
||||
if (this._message !== value) {
|
||||
this._message = value;
|
||||
this.notifyPropertyChange('message', value);
|
||||
}
|
||||
}
|
||||
|
||||
onTap() {
|
||||
this._counter--;
|
||||
this.updateMessage();
|
||||
}
|
||||
|
||||
private updateMessage() {
|
||||
if (this._counter <= 0) {
|
||||
this.message = 'Hoorraaay! You unlocked the NativeScript clicker achievement!';
|
||||
} else {
|
||||
this.message = `${this._counter} taps left`;
|
||||
}
|
||||
}
|
||||
}
|
||||
10
apps/playground/src/package.json
Normal file
10
apps/playground/src/package.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"main": "app.js",
|
||||
"android": {
|
||||
"v8Flags": "--nolazy --expose_gc",
|
||||
"markingMode": "none",
|
||||
"codeCache": "true",
|
||||
"suppressCallJSMethodExceptions": false
|
||||
},
|
||||
"discardUncaughtJsExceptions": false
|
||||
}
|
||||
17
apps/playground/tsconfig.json
Normal file
17
apps/playground/tsconfig.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"noEmitHelpers": true,
|
||||
"noEmitOnError": true,
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2018", "dom"],
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"~/*": ["src/*"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules", "platforms"]
|
||||
}
|
||||
7
apps/playground/tsconfig.tns.json
Normal file
7
apps/playground/tsconfig.tns.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig",
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user