Track which versions of your NativeScript App, a user has previously installed.
Run the following command from the root of your project:
$ tns plugin add nativescript-version-tracking
The best way to explore the usage of the plugin is to inspect the demo app in the plugin's root folder.
This plugin needs to be initialized when your app starts.
TypeScript
import * as app from 'tns-core-modules/application';
import versionTracking from 'nativescript-version-tracking';
app.on('launch', () => {
versionTracking.init();
});
Javascript
var app = require('tns-core-modules/application');
var versionTracking = require('nativescript-version-tracking');
app.on('launch', function () {
versionTracking.init();
});
You can make use of the plugin whenever you want. For example, a user has launched several previous versions, and this is the first time he's launched the new version 2.0.1:
versionTracking.isFirstLaunchEver; // false
versionTracking.isFirstLaunchForVersion; // true
versionTracking.isFirstLaunchForBuild; // true
versionTracking.currentVersion; // 2.0.1
versionTracking.previousVersion; // 2.0.0
versionTracking.firstInstalledVersion; // 1.0.0
versionTracking.versionHistory; // [1.0.0, 1.0.1, 1.0.2, 2.0.0, 2.0.1]
versionTracking.currentBuild; // 18
versionTracking.previousBuild; // 15
versionTracking.firstInstalledBuild; // 1
versionTracking.buildHistory; // [1, 2, 3, 4, 5, 8, 9, 10, 11, 13, 15, 18]
versionTracking.firstLaunchForVersion('3.0.0') // false
versionTracking.firstLaunchForBuild('20') // false
Property | Default | Description |
---|---|---|
isFirstLaunchEver | - | Check if this is the first time ever that the app is launched. |
isFirstLaunchForVersion | - | Check if this is the first time the current version is being launched. |
isFirstLaunchForBuild | - | Check if this is the first time the current build is being launched. |
currentVersion | - | Returns the current version of the app. |
previousVersion | - | Returns the previous version of the app. |
firstInstalledVersion | - | Returns the version which the user first installed the app. |
versionHistory | [] | Returns a list of versions which the user has had installed, e.g. ['2.1', '3.5', '4.0', '4.1']. The List is ordered from the first version installed to (including) the current version |
currentBuild | - | Returns the current build of the app. |
previousBuild | - | Returns the previous build of the app. |
firstInstalledBuild | - | Returns the build which the user first installed the app. |
buildHistory | [] | Returns a list of builds which the user has had installed, e.g. ['2100', '3500', '4000', '4100']. The List is ordered from the first build installed to (including) the current build. |
Method | Returns | Description |
---|---|---|
init(versionsKey?: string, buildsKey?: string) | void | Initializes the plugin. Calling this method is required. A good place to call it is at the application onLaunch() method. |
firstLaunchForVersion(version: string) | boolean | Check if this is the first launch for a particular version number. Useful if you want to execute some code for the first time launches of a particular version. |
firstLaunchForBuild(build: string) | boolean | Check if this is the first launch for a particular build number. Useful if you want to execute some code for the first time launches of a particular build. |
This project is sponsored by Bazzite. If you require assistance on your project(s), please contact us at https://www.bazzite.com/contact.
Please make sure to read the Contributing Guide before making a pull request.
Everyone participating in this project is expected to agree to abide by the Code of Conduct.
Code released under the MIT License.
Originally inspired by VersionTrackingPlugin.
签名 m.version 参数 类型 是否必须 描述 返回 String 返回版本号 工作原理 m.version 属性会返回当前 Mithril 的版本号。 版本号使用 semver 规范,格式为 “0.0.0”,第一个数字是主板本号,第二个数字是次版本好,第三个数字是修订版本号。 当有向下不兼容的 API 更改时,更新主版本号 当添加新功能,且向下兼容时,更新次版本号 当修复 bug,且向下兼
返回当前 Rax core 的版本。 API version: string 示例 import { version } from 'rax'; console.log('version: ', version); // ==> version: 1.0.4
藐视: 描述版本信息。 概述 @version标签后面的文本将被用于表示该项的版本。 例子 例如,使用@version标签: /** * Solves equations of the form a * x = b. Returns the value * of x. * @version 1.2.3 * @tutorial solver */ function solver(a, b
Updates the package version. Updating versions Using the yarn version command you can update the version of your package via the command line. For example, starting with this package.json package.json
THING~ Version Version 标记封装类 new Version()
IntelliJ支持各种版本控制系统,如Git,Subversion,Mercurial,CVS,GitHub和TFS。 您可以从IDE本身执行与版本控制相关的操作。 在本章中,我们将讨论Git和Subversion(以下简称SVN)。 我们假设读者熟悉Git和SVN工具及其术语。 Git 在本节中,我们将学习如何使用Git。 Clone 要克隆现有的Git存储库 - 从Version Contr