Skip to content

Commit c6434fc

Browse files
committed
fix: Import instead of require
1 parent d3e8533 commit c6434fc

File tree

4 files changed

+71
-71
lines changed

4 files changed

+71
-71
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Third-party patches are essential for keeping nativescript-facebook plugin great
1010
git clone git@github.com:<your-username>/nativescript-facebook.git
1111

1212
* Make commits of logical units.
13-
* Make sure your commit messages are in the proper format. We are strongly recommend to use [semantic commit messages](https://seesparkbox.com/foundry/semantic_commit_messages)
13+
* Make sure your commit messages are in the proper format. We strongly recommend to use [semantic commit messages](https://seesparkbox.com/foundry/semantic_commit_messages)
1414
* Add tests for your changes and make them pass. How to run tests you can find in [Testing section](#Testing)
1515
* Push your changes to a topic branch in your fork of the repository.
1616
* Submit a pull request to the **nativescript-facebook** repository.

demo-angular/app/pages/home/home.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Component, ChangeDetectorRef } from "@angular/core";
22
import * as Facebook from "nativescript-facebook";
33
import { NavigationService } from "../../services/navigation.service";
44
import { config } from "../../app.config";
5-
let http = require("tns-core-modules/http");
6-
let appSettings = require("tns-core-modules/application-settings");
5+
import * as http from "tns-core-modules/http";
6+
import * as appSettings from "tns-core-modules/application-settings";
77

88
@Component({
99
selector: "home",
@@ -20,13 +20,13 @@ export class HomeComponent {
2020
constructor(private ref: ChangeDetectorRef, private navigationService: NavigationService) {
2121
// Get logged in user's info
2222
http.getJSON(config.FACEBOOK_GRAPH_API_URL + "/me?access_token=" + this.accessToken).then((res) => {
23-
this.username = res.name;
24-
this.userId = res.id;
23+
this.username = res["name"];
24+
this.userId = res["id"];
2525

2626
// Get logged in user's avatar
2727
// ref: https://github.com/NativeScript/NativeScript/issues/2176
2828
http.getJSON(config.FACEBOOK_GRAPH_API_URL + "/" + this.userId + "/picture?type=large&redirect=false&access_token=" + this.accessToken).then((res) => {
29-
this.avatarUrl = res.data.url;
29+
this.avatarUrl = res["data"]["url"];
3030
this.ref.detectChanges();
3131
}, function (err) {
3232
alert("Error getting user info: " + err);

demo-angular/app/pages/login/login.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, ChangeDetectorRef } from "@angular/core";
22
import * as Facebook from "nativescript-facebook";
33
import { NavigationService } from "../../services/navigation.service";
4-
let appSettings = require("tns-core-modules/application-settings");
4+
import * as appSettings from "tns-core-modules/application-settings";
55

66
@Component({
77
selector: "login",

src/package.json

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
{
2-
"name": "nativescript-facebook",
3-
"version": "2.0.0",
4-
"description": "NativeScript plugin, wrapper of native Facebook SDK for Adroid and iOS.",
5-
"nativescript": {
6-
"platforms": {
7-
"android": "3.0.0",
8-
"ios": "3.0.0"
9-
}
10-
},
11-
"scripts": {
12-
"ngc": "node --max-old-space-size=8192 ./node_modules/.bin/ngc",
13-
"build": "npm i && tsc && npm run ngc",
14-
"ci.tslint": "tslint *.ts && tslint ../demo/app/*.ts && tslint ../demo-angular/app/*.ts",
15-
"ci.android": "npm run build && cd ../demo && tns build android",
16-
"ci.ios": "npm run build && cd ../demo && tns build ios",
17-
"ci.test.ios": "npm run build && cd ../demo && tns platform remove ios && tns test ios",
18-
"ci.test.android": "npm run build && cd ../demo && tns platform remove android && tns test android",
19-
"ci.test.ios.angular": "npm run build && cd ../demo-angular && tns platform remove ios && tns test ios",
20-
"ci.test.android.angular": "npm run build && cd ../demo-angular && tns platform remove android",
21-
"ci.uitest.ios": "cd ../demo && npm run appium --runtype=ios-simulator10",
22-
"ci.uitest.android": "cd ../demo && npm run appium --runtype=android23",
23-
"prepublishOnly": "npm run build"
24-
},
25-
"repository": {
26-
"type": "git",
27-
"url": "https://github.com/NativeScript/nativescript-facebook.git"
28-
},
29-
"keywords": [
30-
"NativeScript",
31-
"TypeScript",
32-
"Android",
33-
"iOS",
34-
"Facebook"
35-
],
36-
"author": {
37-
"name": "NativeScript Team",
38-
"email": "support@telerik.com",
39-
"url": "http://www.telerik.com"
40-
},
41-
"maintainers": [{
42-
"name": "angeltsvetkov",
43-
"email": "angel.tsvetkov@progress.com"
2+
"name": "nativescript-facebook",
3+
"version": "2.0.0",
4+
"description": "NativeScript plugin, wrapper of native Facebook SDK for Adroid and iOS.",
5+
"nativescript": {
6+
"platforms": {
7+
"android": "3.0.0",
8+
"ios": "3.0.0"
9+
}
4410
},
45-
{
46-
"name": "Dimitar Tachev",
47-
"email": "dimitar.tachev@progress.com"
48-
}
49-
],
50-
"bugs": {
51-
"url": "https://github.com/NativeScript/nativescript-facebook/issues"
52-
},
53-
"license": "Apache 2.0",
54-
"homepage": "https://github.com/NativeScript/nativescript-facebook",
55-
"readmeFilename": "README.md",
56-
"devDependencies": {
57-
"tns-core-modules": "^3.0.0",
58-
"tns-platform-declarations": "^3.0.0",
59-
"typescript": "~2.2.2",
60-
"nativescript-angular": "^3.0.0 || ^2.0.0-rc.1",
61-
"@angular/core": "~4.0.1",
62-
"@angular/common": "~4.0.1",
63-
"@angular/compiler": "~4.0.1",
64-
"@angular/compiler-cli": "~4.0.1",
65-
"rxjs": "~5.3.0",
66-
"zone.js": "~0.8.4"
11+
"scripts": {
12+
"ngc": "node --max-old-space-size=8192 ./node_modules/.bin/ngc",
13+
"build": "npm i && tsc && npm run ngc",
14+
"ci.tslint": "tslint *.ts && tslint ../demo/app/*.ts && tslint ../demo-angular/app/*.ts",
15+
"ci.android": "npm run build && cd ../demo && tns build android",
16+
"ci.ios": "npm run build && cd ../demo && tns build ios",
17+
"ci.test.ios": "npm run build && cd ../demo && tns platform remove ios && tns test ios",
18+
"ci.test.android": "npm run build && cd ../demo && tns platform remove android && tns test android",
19+
"ci.test.ios.angular": "npm run build && cd ../demo-angular && tns platform remove ios && tns test ios",
20+
"ci.test.android.angular": "npm run build && cd ../demo-angular && tns platform remove android",
21+
"ci.uitest.ios": "cd ../demo && npm run appium --runtype=ios-simulator10",
22+
"ci.uitest.android": "cd ../demo && npm run appium --runtype=android23",
23+
"prepublishOnly": "npm run build"
24+
},
25+
"repository": {
26+
"type": "git",
27+
"url": "https://github.com/NativeScript/nativescript-facebook.git"
28+
},
29+
"keywords": [
30+
"NativeScript",
31+
"TypeScript",
32+
"Android",
33+
"iOS",
34+
"Facebook"
35+
],
36+
"author": {
37+
"name": "NativeScript Team",
38+
"email": "support@telerik.com",
39+
"url": "http://www.telerik.com"
40+
},
41+
"maintainers": [{
42+
"name": "angeltsvetkov",
43+
"email": "angel.tsvetkov@progress.com"
44+
},
45+
{
46+
"name": "Dimitar Tachev",
47+
"email": "dimitar.tachev@progress.com"
48+
}
49+
],
50+
"bugs": {
51+
"url": "https://github.com/NativeScript/nativescript-facebook/issues"
52+
},
53+
"license": "Apache 2.0",
54+
"homepage": "https://github.com/NativeScript/nativescript-facebook",
55+
"readmeFilename": "README.md",
56+
"devDependencies": {
57+
"tns-core-modules": "^3.0.0",
58+
"tns-platform-declarations": "^3.0.0",
59+
"typescript": "~2.2.2",
60+
"nativescript-angular": "^3.0.0 || ^2.0.0-rc.1",
61+
"@angular/core": "~4.0.1",
62+
"@angular/common": "~4.0.1",
63+
"@angular/compiler": "~4.0.1",
64+
"@angular/compiler-cli": "~4.0.1",
65+
"rxjs": "~5.3.0",
66+
"zone.js": "~0.8.4"
6767
},
6868
"peerDependencies": {
6969
"tns-core-modules": "^3.0.0"

0 commit comments

Comments
 (0)