Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Conversation

NickIliev
Copy link
Contributor

new core-concepts/utils.md article + code snippet changes related to modules-30

*/

import application = require("application");
import * as application from "application";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we import only the used methods from application?

import { on, uncaughtErrorEvent } from "application";

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed but I think it is better to leave this specific example to import application as it is more readable application.on instead of just on

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use:
import { on as applicationOn }

the application module exports 46 things and we don't need most of them. If we import the whole module we can't benefit from the treeshaking that uglify.js performs.

``` TypeScript
import observable = require("data/observable");
import applicationSettings = require("application-settings");
import * as observable from "data/observable";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { EventData } from "data/observable";

import observable = require("data/observable");
import applicationSettings = require("application-settings");
import * as observable from "data/observable";
import * as applicationSettings from "application-settings";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

"es2016"
"compilerOptions": {
...
"lib": ["es6", "dom"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have comma at the end of the row

## isFileOrResourcePath method

Allows you to verify if the specified path points to a resource or local file. The method will return boolen value:
`true` - if the string contains valid path structure.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the new line is not rendered correctly here - check out the md version of the article.

ui/action-bar.md Outdated
import observable = require("data/observable");
import view = require("ui/core/view");
import * as observable from "data/observable";
import * as view from "ui/core/view";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { View } from "ui/core/view";

ui/icon-fonts.md Outdated
import observable = require("data/observable");
import pages = require("ui/page");
import * as observable from "data/observable";
import * as pages from "ui/page";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { Page } from "ui/page";

ui/icon-fonts.md Outdated
``` TypeScript
import observable = require("data/observable");
import pages = require("ui/page");
import * as observable from "data/observable";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { EventData, Observable } from "data/observable";

```
```TypeScript
import placeholder = require("ui/placeholder");
import * as placeholder from "ui/placeholder";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { CreateViewEventData } from "ui/placeholder";

Also there is one more snippet below that needs to be updated.

var utilsModule = require("tns-core-modules/utils/utils");
```
```TypeScript
import * as utils from "tns-core-modules/utils/utils";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can write something like this instead:

import { ... } from "tns-core-modules/utils/utils";

@NickIliev NickIliev merged commit e4811c7 into master May 2, 2017
@NickIliev NickIliev deleted the modules-30 branch May 3, 2017 06:24
@lock
Copy link

lock bot commented Aug 27, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants