3.0.4 • Published 6 years ago

nativescript-toolbox-sw v3.0.4

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

npm npm

NativeScript Toolbox

A NativeScript module that is a composition of useful classes, tools and helpers.

The module contains the following sub modules:

NameDescription
crypto-jsLibrary of crypto standards.
JS-YAMLYAML 1.2 parser / writer.
markdownMarkdown parser.
MomentA lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
nativescript-apiclientSimply call HTTP based APIs.
nativescript-batchImplement batch operations.
nativescript-bitmap-factoryCreate and manipulate bitmap images.
nativescript-emailAn Email plugin for use in your NativeScript app. You can use it to compose emails, edit the draft manually, and send it.
nativescript-enumerableProvides LINQ style extensions for handling arrays and lists.
nativescript-lazyProvides an OOP version of the build-in lazy function.
nativescript-routed-valuesImplement routed value graphs.
nativescript-sqlite (free)Provides sqlite actions.
nativescript-stringformatHelpers for handling strings.
nativescript-xmlobjectsHandles XML data as objects similar to LINQ to XML.

Donate

License

MIT license

Platforms

  • Android
  • iOS

Installation

Run

tns plugin add nativescript-toolbox

inside your app project to install the module.

Usage

import Toolbox = require('nativescript-toolbox');

The module provides the following function that are short hands for the included sub modules:

NameDescription
allowToSleepAllows the device to go to sleep mode (based on nativescript-insomnia).
asBitmapReturns a value as bitmap object.
asEnumerableReturns a value as sequence.
createBitmapCreates a new bitmap.
decryptDecrypts a value / an object with AES.
encryptEncrypts a value / an object with AES.
formatFormats a string.
formatArrayFormats a string.
fromMarkdownConverts Markdown code.
fromXmlAlias for 'parseXml'.
fromYamlAlias for 'parseYaml'.
getApplicationContextReturns the current application context.
getClipboardReturns an object that handles the clipboard of the device.
getNativeViewReturns the native view of the app.
getOrientationGets the current orientation of the device (based on nativescript-orientation).
getPlatformReturns information of the current platform.
getValueTries to return a value / object that is stored in the application settings.
guidAlias for 'uuid'.
hashGeneric hash function.
hasValueChecks if a value / object is stored in the application settings.
hideStatusBarShort hand function for 'setStatusBarVisibility' for hiding the status bar.
invokeForConnectivityInvokes logic for a specific connectivity type. Requires permissions on Android (android.permission.ACCESS_NETWORK_STATE), e.g.
invokeForOrientationInvokes a callback for specific orientation mode.
invokeForPlatformInvokes an action for a specific platform.
isEnumerableChecks if a value is a sequence.
keepAwakeKeeps the device awake (based on nativescript-insomnia).
markdownToHtmlShort hand for 'fromMarkdown()' with HTML as target format.
markdownToJsonShort hand for 'fromMarkdown()' with JSON as target format.
md5Hashes a value with MD5.
newBatchCreates a new batch.
newClientCreates a new API client.
nowGets the current time.
openDatabaseOpens a (SQLite) database (connection).
openUrlOpen an URL on the device.
openWifiSettingsOpens the WiFi settings on the device.
parseXmlParses a XML string to an object.
parseYamlParses YAML data to an object.
removeValueRemoves a value / object that is stored in the application settings.
setStatusBarVisibilityChanges the visibility of the device's status bar (based on nativescript-status-bar).
setValueStores a value / object in the application settings.
sha1Hashes a value with SHA-1.
sha256Hashes a value with SHA-256.
sha3Hashes a value with SHA-3.
sha384Hashes a value with SHA-384.
sha512Hashes a value with SHA-512.
showStatusBarShort hand function for 'setStatusBarVisibility' for showing the status bar.
startMonitoringForConnectivityStarts monitoring for connectivity (changes). Requires permissions on Android (android.permission.ACCESS_NETWORK_STATE), e.g.
stopMonitoringForConnectivityStops monitoring for connectivity. Requires permissions on Android (android.permission.ACCESS_NETWORK_STATE), e.g.
toYamlConverts an object / a value to YAML.
uuidCreates a new unique ID / GUID (s. Create GUID / UUID in JavaScript?).
vibrateVibrates the device. Requires permissions on Android (android.permission.VIBRATE), e.g. (based on nativescript-vibrate)

Sub modules

crypto-js

Here are some examples of common algorithms:

Encrypters
var AES = require("nativescript-toolbox/crypto-js/aes");
Hashes
var MD5 = require('nativescript-toolbox/crypto-js/md5');
var SHA1 = require('nativescript-toolbox/crypto-js/sha1');
var SHA256 = require('nativescript-toolbox/crypto-js/sha256');
var SHA3 = require('nativescript-toolbox/crypto-js/sha3');
var SHA384 = require('nativescript-toolbox/crypto-js/sha384');
var SHA512 = require('nativescript-toolbox/crypto-js/sha512');

JS-YAML

var YAML = require('nativescript-toolbox/js-yaml');

markdown

var Markdown = require('nativescript-toolbox-sw/markdown').markdown;

var json = Markdown.parse('Vessel     | Captain\n-----------|-------------\nNCC-1701   | James T Kirk\nNCC-1701 A | James T Kirk\nNCC-1701 D | Picard',
                          'Maruku');
var html = Markdown.toHTML('Vessel     | Captain\n-----------|-------------\nNCC-1701   | James T Kirk\nNCC-1701 A | James T Kirk\nNCC-1701 D | Picard',
                           'Maruku');

Moment

import Moment = require('nativescript-toolbox/moment');

nativescript-apiclient

import ApiClient = require('nativescript-toolbox/apiclient');

nativescript-batch

import Batch = require('nativescript-toolbox/batch');

nativescript-bitmap-factory

import BitmapFactory = require('nativescript-toolbox/bitmap-factory');

nativescript-email

import Email = require('nativescript-toolbox/email');

nativescript-enumerable

import Enumerable = require('nativescript-toolbox/enumerable');

nativescript-lazy

import Lazy = require('nativescript-toolbox/lazy');

nativescript-routed-values

import RoutedValues = require('nativescript-toolbox/routed-values');

nativescript-sqlite

var SQLite = require('nativescript-toolbox/sqlite');

nativescript-stringformat

import StringFormat = require('nativescript-toolbox/stringformat');

nativescript-xmlobjects

import XmlObjects = require('nativescript-toolbox/xmlobjects');