UNPKG

7.37 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var plugin_1 = require('./plugin');
9/**
10 * @name Globalization
11 * @description
12 * @usage
13 * ```typescript
14 * import { Globalization } from 'ionic-native';
15 *
16 *
17 * ```
18 */
19var Globalization = (function () {
20 function Globalization() {
21 }
22 /**
23 * Returns the BCP-47 compliant language identifier tag to the successCallback with a properties object as a parameter. That object should have a value property with a String value.
24 * @returns {Promise<{value: string}>}
25 */
26 Globalization.getPreferredLanguage = function () { return; };
27 /**
28 * Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
29 * @returns {Promise<{value: string}>}
30 */
31 Globalization.getLocaleName = function () { return; };
32 /**
33 * Converts date to string
34 * @param {Date} date Date you wish to convert
35 * @param options Options for the converted date. Length, selector.
36 * @returns {Promise<{value: string}>} Returns a promise when the date has been converted.
37 */
38 Globalization.dateToString = function (date, options) { return; };
39 /**
40 * Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object.
41 * @param {string} dateString Date as a string to be converted
42 * @param options Options for the converted date. Length, selector.
43 * @returns {Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }>} Returns a promise when the date has been converted.
44 */
45 Globalization.stringToDate = function (dateString, options) { return; };
46 /**
47 * Returns a pattern string to format and parse dates according to the client's user preferences.
48 * @param options Object with the format length and selector
49 * @returns {Promise<{pattern: string}>} Returns a promise.
50 */
51 Globalization.getDatePattern = function (options) { return; };
52 /**
53 * Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
54 * @param options Object with type (narrow or wide) and item (month or days).
55 * @returns {Promise<{value: Array<string>}>} Returns a promise.
56 */
57 Globalization.getDateNames = function (options) { return; };
58 /**
59 * Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
60 * @param {data} date Date to process
61 * @returns {Promise<{dst: string}>} reutrns a promise with the value
62 */
63 Globalization.isDayLightSavingsTime = function (date) { return; };
64 /**
65 * Returns the first day of the week according to the client's user preferences and calendar.
66 * @returns {Promise<{value: string}>} returns a promise with the value
67 */
68 Globalization.getFirstDayOfWeek = function () { return; };
69 /**
70 * Returns a number formatted as a string according to the client's user preferences.
71 * @param numberToConvert {Number} The number to convert
72 * @param options {Object} Object with property `type` that can be set to: decimal, percent, or currency.
73 */
74 Globalization.numberToString = function (numberToConvert, options) { return; };
75 /**
76 *
77 * @param {string} stringToConvert String you want to conver to a number
78 * @param options The type of number you want to return. Can be decimal, percent, or currency.
79 * @returns {Promise<{ value: number | string }>} Returns a promise with the value.
80 */
81 Globalization.stringToNumber = function (stringToConvert, options) { return; };
82 /**
83 * Returns a pattern string to format and parse numbers according to the client's user preferences.
84 * @param options Can be decimal, percent, or currency.
85 * @returns {Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }>}
86 */
87 Globalization.getNumberPattern = function (options) { return; };
88 /**
89 * Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
90 * @param {string} currencyCode Currency Code.A
91 * @returns {Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }>}
92 */
93 Globalization.getCurrencyPattern = function (currencyCode) { return; };
94 __decorate([
95 plugin_1.Cordova()
96 ], Globalization, "getPreferredLanguage", null);
97 __decorate([
98 plugin_1.Cordova()
99 ], Globalization, "getLocaleName", null);
100 __decorate([
101 plugin_1.Cordova({
102 successIndex: 1,
103 errorIndex: 2
104 })
105 ], Globalization, "dateToString", null);
106 __decorate([
107 plugin_1.Cordova({
108 successIndex: 1,
109 errorIndex: 2
110 })
111 ], Globalization, "stringToDate", null);
112 __decorate([
113 plugin_1.Cordova({
114 callbackOrder: 'reverse'
115 })
116 ], Globalization, "getDatePattern", null);
117 __decorate([
118 plugin_1.Cordova({
119 callbackOrder: 'reverse'
120 })
121 ], Globalization, "getDateNames", null);
122 __decorate([
123 plugin_1.Cordova()
124 ], Globalization, "isDayLightSavingsTime", null);
125 __decorate([
126 plugin_1.Cordova()
127 ], Globalization, "getFirstDayOfWeek", null);
128 __decorate([
129 plugin_1.Cordova({
130 successIndex: 1,
131 errorIndex: 2
132 })
133 ], Globalization, "numberToString", null);
134 __decorate([
135 plugin_1.Cordova({
136 successIndex: 1,
137 errorIndex: 2
138 })
139 ], Globalization, "stringToNumber", null);
140 __decorate([
141 plugin_1.Cordova({
142 callbackOrder: 'reverse'
143 })
144 ], Globalization, "getNumberPattern", null);
145 __decorate([
146 plugin_1.Cordova()
147 ], Globalization, "getCurrencyPattern", null);
148 Globalization = __decorate([
149 plugin_1.Plugin({
150 pluginName: 'Globalization',
151 plugin: 'cordova-plugin-globalization',
152 pluginRef: 'navigator.globalization',
153 repo: 'https://github.com/apache/cordova-plugin-globalization',
154 platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Firefox OS', 'iOS', 'Windows Phone 8', 'Widnows', 'Browser']
155 })
156 ], Globalization);
157 return Globalization;
158}());
159exports.Globalization = Globalization;
160//# sourceMappingURL=globalization.js.map
\No newline at end of file