Skip to content

Latest commit

 

History

History
86 lines (69 loc) · 7.58 KB

modules.md

File metadata and controls

86 lines (69 loc) · 7.58 KB
nav-title title description position
Modules in NativeScript
Modules
You can access the native device and platform capabilities of your target platform with the help of the NativeScript modules.
5

Modules

To let you access the native device and platform capabilities of your target platform, NativeScript uses a modular design pattern. All device, platform or user interface functionalities reside in separate modules. To access the functionality provided by a module, you need to require the module.

In your project, the files for each module reside in a dedicated subdirectory in the tns_modules directory. Each default module comes along with a package.json file which declares how the module should be called within your call and which file contains its respective code.

{ "name" : "button",
  "main" : "button.js" }

Core Modules

  • application: Provides the application abstraction with all related methods.
  • console: Lets you print messages to the device console.
  • local-settings: Lets you save and restore any information related to your application.
  • http: Lets you send web requests and receive the responses.
  • image-source: Provides the ImageSource class which encapsulates the common abstraction behind a platform-specific object that is used as a source for images (typically a Bitmap).
  • timer: Lets you to create, start, stop and react to timers.
  • trace: Lets you trace and print specific information based on categories.
  • ui/image-cache: Provides the Cache class which handles image download requests and caches the already downloaded images.

Device Functionality Modules

  • camera: Lets you take pictures with the device camera.
  • location: Lets you use the geolocation sensors of the device.
  • platform: Provides information about the device, its operating system and software.
  • fps-meter: Lets you capture the frames-per-second metrics of your application.
  • file-system: Lets you work with the device file system. Provides high-level abstractions for file system entities such as files, folders, known folders, paths, separators, etc.
  • ui/gestures: Provides the GesturesObserver class which lets you observe and respond to user gestures.

Data Modules

  • data/observable: Provides the Observable class which represents an observable object or data in the MVVM paradigm.
  • data/observable-array: Provides the ObservableArray class which detects and responds to changes in a collection of objects.
  • data/virtual-array: Provides the VirtualArray class which is an advanced array-like class that helps loading items on demand.

User Interface Modules

  • ui/core/dependency-observable: Provides the DependencyObservable class which represents an extended Observable object that uses Property instances for value backing mechanism.
  • ui/frame: Provides the Frame class which represents the logical View unit that is responsible for navigation within an application.
  • ui/page: Provides the Page class which represents a logical unit for navigation inside a Frame. NativeScript apps consist of pages.
  • color: Lets you create colors which you can use when you style the UI.
  • text/formatted-string: Provides the FormattedString and Span classes which you can use to create rich text formatted strings.
  • xml: Provides the XmlParser class which is a SAX parser using the easysax implementation.
  • ui/styling: Provides the Style class which is responsible for the visual appearance of elements.
  • ui/border: Provides the Border class which lets you draw borders around other elements.

Layouts

  • ui/layouts/stack-layout: Provides the StackLayout class which lets you arrange the children of the layout in single line.
  • ui/layouts/grid-layout: Provides the GridLayout class which lets you arrange the children of the layout in a flexible grid area with columns and rows.
  • ui/layouts/absolute-layout: Provides the AbsoluteLayout class which lets you arrange the children of the layout at arbitrary positions or draw them in multiple layers.
  • ui/layouts/wrap-layout: Provides the WrapLayout class which lets you arrange the children of the layout at sequential positions from left to right and then wrap the lines of children from top to bottom.

Widgets

  • ui/activity-indicator: Provides the ActivityIndicator class which represents a widget for showing that a service is currently busy.
  • ui/button: Provides the Button class which is a standard button widget.
  • ui/label: Provides the Label class which is a standard label widget.
  • ui/text-field: Provides the TextField class which represents an editable single-line box.
  • ui/text-view: Provides the TextView class which represents an editable multi-line line box.
  • ui/list-view: Provides the ListView class which represents a standard list view widget.
  • ui/image: Provides the Image class, which represents an image widget.
  • ui/progress: Provides the Progress class which represents a progress or loading indicator.
  • ui/scroll-view: Provides the ScrollView class which represents a scrollable area that can show content which is larger than the visible area.
  • ui/search-bar: Provides the SearchBar class which represents a standard search bar component.
  • ui/slider: Provides the Slider class which represents a standard slider component.
  • ui/switch: Provides the Switch class which represents a standard switch component.
  • ui/tab-view: Provides the TabView class which represents a standard content component with tabs.
  • ui/web-view: Provides the WebView class which represents a standard browser widget.
  • ui/dialogs: Lets you show various dialogs such as alerts, prompts, confirmations and others.