Skip to content

Latest commit

Β 

History

History
576 lines (544 loc) Β· 45.3 KB

index.md

File metadata and controls

576 lines (544 loc) Β· 45.3 KB
title API Reference
titleTemplate title - API / NativeScript
description Complete API reference for @nativescript/core.
contributors false

Namespaces

Namespace Description
AccessibilityEvents -
AndroidHelper Various Android view helper methods
ApplicationSettings -
capitalizationType Defines the capitalization type for prompt dialog.
Connectivity -
CoreTypes -
CSSUtils -
DialogStrings -
encoding Defines the supported character encodings.
FixedLength -
FontStyle -
FontVariationSettings -
FontWeight -
GridUnitType -
Http -
inputType Defines the input type for prompt dialog.
IOSHelper Various iOS view helper methods
knownFolders Provides access to the top-level Folders instances that are accessible from the application. Use these as entry points to access the FileSystem.
Length -
path Enables path-specific operations like join, extension, etc.
PercentLength -
Trace -
Utils -

Enumerations

Enumeration Description
AccessibilityLiveRegion -
AccessibilityRole -
AccessibilityState -
AccessibilityTrait -
AndroidDirectory -
CacheMode -
FontScaleCategory -
GestureEvents -
GestureStateTypes -
GestureTypes -
HttpResponseEncoding -
ImageSymbolEffects -
NavigationType -
SharedTransitionAnimationType -
SwipeDirection -
TouchAction -
WritingToolsAllowedInput (iOS Only) Allowed input for Apple Intelligence Writing Tools
WritingToolsBehavior (iOS Only) Behavior for Apple Intelligence Writing Tools

Classes

Class Description
AbsoluteLayout A layout that lets you specify exact locations (left/top coordinates) of its children.
ActionBar Provides an abstraction over the ActionBar (android) and NavigationBar (iOS).
ActionItem Represents an action item in the action bar.
ActionItems Represents a collection of ActionItems.
ActivityIndicator Represents a UI widget which displays a progress indicator hinting the user for some background operation running.
AndroidApplication -
Animation Defines a animation set.
ApplicationCommon -
Background -
Binding -
Builder -
Button Represents a standard Button widget.
ChangeType -
CoercibleProperty -
Color Represents a color object. Stores all color components (alpha (opacity), red, green, blue) in a [0..255] range.
ContainerView Base class for all UI components that are containers.
ContentView -
ControlStateChangeListener An utility class used for supporting styling infrastructure. WARNING: This class is intended for IOS only.
CssAnimationParser -
CssAnimationProperty -
CssProperty -
CustomLayoutView Base class for all UI components that implement custom layouts.
DatePicker Represents an date picker.
DockLayout A Layout that arranges its children at its outer edges, and allows its last child to take up the remaining space.
EditableTextBase Represents the base class for all editable text views.
FadeTransition -
File Represents a File entity on the file system.
FileSystemEntity Represents a single entity on the file system.
FlexboxLayout -
Folder Represents a Folder (directory) entity on the file system.
Font -
FormattedString A class used to create a formatted (rich text) string.
Frame Represents the logical View unit that is responsible for navigation within an application. Nested frames are supported, enabling hierarchical navigation scenarios.
GesturesObserver Provides options for the GesturesObserver.
GridLayout Defines a rectangular layout area that consists of columns and rows.
HtmlView Represents a view with html content. Use this component instead WebView when you want to show just static HTML content. iOS support android support
Image Represents a class that provides functionality for loading and streching image(s).
ImageAsset Observable is used when you want to be notified when a change occurs. Use on/off methods to add/remove listener. Please note that should you be using the new Observable({}) constructor, it is obsolete since v3.0, and you have to migrate to the "data/observable" fromObject({}) or the fromObjectRecursive({}) functions.
ImageCache Represents a class that stores handles image download requests and caches the already downloaded images.
ImageSource Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.
ImageSymbolEffect iOS only Symbol effects: https://developer.apple.com/documentation/symbols?language=objc
InheritedCssProperty -
InheritedProperty -
iOSApplication -
ItemSpec Defines row/column specific properties that apply to GridLayout elements.
KeyframeAnimation -
KeyframeAnimationInfo -
KeyframeDeclaration -
KeyframeInfo -
Label Represents a text label.
LayoutBase Base class for all views that supports children positioning.
LinearGradient -
LiquidGlass -
LiquidGlassContainer -
ListPicker Represents an list picker.
ListView Represents a view that shows items in a vertically scrolling list.
ModalTransition -
ModuleNameResolver -
NativeWindow A window surface that hosts a NativeScript view tree.
NavigationButton Represents the navigation (a.k.a. "back") button.
Observable Observable is used when you want to be notified when a change occurs. Use on/off methods to add/remove listener. Please note that should you be using the new Observable({}) constructor, it is obsolete since v3.0, and you have to migrate to the "data/observable" fromObject({}) or the fromObjectRecursive({}) functions.
ObservableArray Advanced array like class used when you want to be notified when a change occurs.
Page Represents a logical unit for navigation (inside Frame).
PageBase -
PageTransition -
ParserEvent Provides information for a parser event.
ParserEventType Specifies the type of parser event.
Placeholder Represents a Placeholder, which is used to add a native view to the visual tree.
Progress Represents a progress component.
Property -
ProxyViewContainer Proxy view container that adds all its native children directly to the parent. To be used as a logical grouping container of views.
Repeater Represents a UI Repeater component.
RootLayout -
Screen An object describing general information about a display.
ScrollView Represents a scrollable area that can have content that is larger than its bounds.
SearchBar Represents a search bar component.
SegmentedBar Represents a UI SegmentedBar component.
SegmentedBarItem Represents a SegmentedBar item.
SharedTransition Shared Element Transitions (preview) Allows you to auto animate between shared elements on two different screesn to create smooth navigational experiences. View components can define sharedTransitionTag="name" alone with a transition through this API.
SharedTransitionHelper Platform helper to aid in creating your own custom Shared Element Transition classes. (iOS Only)
ShorthandProperty -
Slider Represents a slider component.
SlideTransition -
Span A class used to create a single part of formatted string with a common text properties.
SplitView iOS UISplitViewController-backed container. On Android, acts as a simple container.
StackLayout A Layout that arranges its children horizontally or vertically. The direction can be set by orientation property.
Style Observable is used when you want to be notified when a change occurs. Use on/off methods to add/remove listener. Please note that should you be using the new Observable({}) constructor, it is obsolete since v3.0, and you have to migrate to the "data/observable" fromObject({}) or the fromObjectRecursive({}) functions.
Switch Represents a switch component.
TabView Represents a tab view.
TabViewItem Represents a tab view entry.
TextBase -
TextField Represents an editable text field.
TextView Represents an editable multiline text view.
TimePicker Represents an time picker.
TouchManager Manage interactivity in your apps easily with TouchManager. Store reusable down/up animation settings for touches as well as optionally enable automatic tap (down/up) animations for your app.
Transition -
View This class is the base class for all UI components. A View occupies a rectangular area on the screen and is responsible for drawing and layouting of all UI components within.
ViewBase -
ViewHelper -
VirtualArray Advanced array like class that helps loading items on demand.
WebView Represents a standard WebView widget.
WindowBase Cross-platform base for any window surface.
WrapLayout WrapLayout position children in rows or columns depending on orientation property until space is filled and then wraps them on new row or column.
WrappedValue Helper class that is used to fire property change even when real object is the same. By default property change will not be fired for a same object. By wrapping object into a WrappedValue instance same object restriction will be passed.
XmlParser A simple non-validating SAX parser based on https://github.com/vflash/easysax version 0.1.14

Interfaces

Interface Description
AccessibilityDecrementEventData Base event data.
AccessibilityIncrementEventData Base event data.
ActionOptions Provides options for the dialog.
AddArrayFromBuilder Defines an interface for adding arrays declared in xml.
AddChildFromBuilder Defines an interface for adding a child element declared in xml.
AlertOptions Provides options for the alert.
AndroidActivityBackPressedEventData Data for the Android activity back pressed event.
AndroidActivityBundleEventData Data for the Android activity events with bundle.
AndroidActivityCallbacks -
AndroidActivityEventData Data for the Android activity events.
AndroidActivityNewIntentEventData Data for the Android activity newIntent event.
AndroidActivityRequestPermissionsEventData Data for the Android activity onRequestPermissions callback
AndroidActivityResultEventData Data for the Android activity result event.
AndroidOverflowInsetData Defines the data for the androidOverflowInset event.
AnimationDefinition -
AnimationDefinitionInternal -
ApplicationEventData Event data containing information for the application events.
BackstackEntry Represents an entry in the back stack of a Frame object.
BindingOptions The options object used in the Bindable.bind method.
Cancelable -
CancelableOptions Provides options for the dialog.
ChangedData Event args for "changed" event.
CommonLayoutParams -
ComponentModule -
ConfirmOptions Provides options for the confirm dialog.
CreateViewEventData Event data containing information for creating a native view that will be added to the visual tree.
CssChangedEventData Event data containing information about application css change.
DialogOptions Provides options for the dialog.
DiscardedErrorEventData Event data containing information about discarded application errors.
DownloadedData Provides data for downloaded event.
DownloadError Provides data for download error.
DownloadRequest Represents a single download request.
EventData Base event data.
EventDataValue Base event data.
FontScaleChangedEventData Event data containing information for font scale changed event.
GestureEventData Base event data.
GestureEventDataWithState Base event data.
HttpContent Encapsulates the content of an HttpResponse.
HttpRequestOptions Provides options for the http requests.
HttpResponse Encapsulates HTTP-response information from an HTTP-request.
IDevice -
ImageAssetOptions -
InitRootViewEventData Event data containing information about root view application.
IOSView This class is the base class for all UI components. A View occupies a rectangular area on the screen and is responsible for drawing and layouting of all UI components within.
ItemEventData Event data containing information for the index and the view associated to a list view item.
ItemsLoading Event args for "itemsLoading" event.
ItemsSource -
KeyedTemplate Defines an interface for Template with a key.
LaunchEventData Event data containing information for launch event.
LayoutDirectionChangedEventData Event data containing information for system layout direction changed event.
LoadAppCSSEventData Event data containing information for the application events.
LoadEventData Event data containing information for the loading events of a WebView.
LoadOptions -
LoginOptions Provides options for the login dialog.
LoginResult Provides result data from the login dialog.
NativeScriptConfig IMPORTANT: this is not generated automatically due to this issue: microsoft/TypeScript#36763 the reference path above will get rewritten and break on compilation unless kept here Once issue is resolve we can remove this index.d.ts from repo and go back to auto generation on tsc
NativeScriptError An extended JavaScript Error which will have the nativeError property initialized in case the error is caused by executing platform-specific code.
NativeWindowEventData Base event data for NativeWindow events.
NavigatedData Defines the data for the page navigation events.
NavigationContext Represents a context passed to navigation methods.
NavigationData Base event data.
NavigationEntry Represents an entry in passed to navigate method.
NavigationTransition Represents an object specifying a page navigation transition.
OrientationChangedEventData Event data containing information for orientation changed event.
Pair -
PanGestureEventData Base event data.
PinchGestureEventData Base event data.
PlatformContext Used with qualifier matchers and module resolution
Point3D -
PrimaryWindowChangedEventData Event data fired on Application when the primary window changes.
PromptOptions Provides options for the prompt dialog.
PromptResult Provides result data from the prompt dialog.
PropertyAnimation -
PropertyAnimationInfo -
PropertyChangeData Data for the "propertyChange" event.
RootLayoutOptions -
RotationGestureEventData Base event data.
SceneContinueUserActivityEventData iOS event data for the sceneContinueUserActivity event, raised for Handoff and universal links directed at a scene.
SceneEventData iOS Event data containing information for scene lifecycle events (iOS 13+).
SceneOpenURLContextsEventData iOS event data for the sceneOpenURLContexts event, raised when a scene is asked to open URLs.
ScenePerformActionForShortcutItemEventData iOS event data for the scenePerformActionForShortcutItem event, raised when a home screen quick action targets a scene.
ScrollEventData Base event data.
SearchEventData Event data containing information for the search text change event.
SelectedIndexChangedEventData Defines the data for the SegmentedBar.selectedIndexChanged event.
ShadeCoverOptions -
ShadowCSSValues -
SharedTransitionConfig -
ShowModalOptions -
ShownModallyData Defines the data for the shownModally event.
Size The Size interface describes abstract dimensions in two dimensional space. It has two properties width and height, representing the width and height values of the size.
StrokeCSSValues -
SwipeGestureEventData Base event data.
SystemAppearanceChangedEventData Event data containing information for system appearance changed event.
TapGestureEventData Base event data.
Template Defines an interface for a View factory function. Commonly used to specify the visualization of data objects.
TemplatedItemsView -
TimerInfo Contains contains utility methods for profiling. All methods in this module are experimental and may be changed in a non-major version.
TouchGestureEventData -
TraceErrorHandler An interface used to for handling trace error
TraceEventListener An interface used to trace information about specific event.
TraceWriter An interface used to define a writer used by trace to print (log).
UnhandledErrorEventData Event data containing information about unhandled application errors.
ViewEntry Represents an entry to be used to create a view or load it form file
WindowBaseEventData Base event data for window surface events.
WindowCloseEventData Event data fired on Application when a window closes.
WindowContentRequest Describes the window asking for content.
WindowLayoutDirectionChangedEventData Event data for the layoutDirectionChanged event of a NativeWindow.
WindowOpenEventData Event data fired on Application when a window opens.
WindowOpenOptions Options for opening a new window.
WindowOrientationChangedEventData Event data for the orientationChanged event of a NativeWindow.
WindowSystemAppearanceChangedEventData Event data for the systemAppearanceChanged event of a NativeWindow.

Type Aliases

Type Alias Description
AlignContent -
AlignItems -
AlignSelf -
AnimationPromise -
dip -
Flex -
FlexDirection -
FlexFlow -
FlexWrap -
FontStyleType -
FontVariationSettingsType -
FontWeightType -
GlassEffectConfig -
GlassEffectType -
GlassEffectVariant Glass effects
GridUnitType -
Headers -
HorizontalAlignment -
InstrumentationMode Profiling mode to use. - counters Accumulates method call counts and times until dumpProfiles is called and then prints aggregated statistic in the console. This is the default. - timeline Outputs method names along start/end timestamps in the console on the go. - lifecycle Outputs basic non-verbose times for startup, navigation, etc.
iosSymbolScaleType iOS only SF Symbol scale
JustifyContent -
LengthDipUnit -
LengthPercentUnit -
LengthPxUnit -
LengthType -
ModuleListProvider -
NativeWindowEventName -
percent -
PercentLengthType -
px -
SceneEventName -
SharedTransitionTagProperties Properties which can be set on individual Shared Elements
SplitBehavior -
SplitDisplayMode -
SplitRole -
SplitStyle -
TouchAnimationOptions -
Transformation -
TransformationType -
TransformationValue -
TransformFunctionsInfo -
VerticalAlignment -
VisionHoverOptions -
WebViewNavigationType Represents navigation type
WindowContentResolver Supplies the UI for a window that needs content. Called once per window that needs it.
WindowRole The purpose a window surface serves.
WindowState The lifecycle state of a window surface.

Variables

Variable Description
_resetRootView -
addCss -
android -
androidDynamicElevationOffsetProperty -
androidElevationProperty -
androidRegisterBroadcastReceiver -
AnimationCurve -
Application -
autocapitalizationTypeProperty -
autocorrectProperty -
backgroundColorProperty -
backgroundEvent -
backgroundImageProperty -
backgroundInternalProperty -
backgroundPositionProperty -
backgroundRepeatProperty -
backgroundSizeProperty -
borderBottomColorProperty -
borderBottomLeftRadiusProperty -
borderBottomRightRadiusProperty -
borderBottomWidthProperty -
borderLeftColorProperty -
borderLeftWidthProperty -
borderRightColorProperty -
borderRightWidthProperty -
borderTopColorProperty -
borderTopLeftRadiusProperty -
borderTopRightRadiusProperty -
borderTopWidthProperty -
clipPathProperty -
colorProperty -
columnGapProperty -
cornerShapeProperty -
CSSHelper -
Device Gets the current device information.
Dialogs Singular rollup for convenience of all dialog methods
directionProperty -
discardedErrorEvent -
displayedEvent -
editableProperty -
Enums -
exitEvent -
fontFamilyProperty -
fontInternalProperty -
fontScaleChangedEvent -
fontScaleInternalProperty -
fontSizeProperty -
fontStyleProperty -
fontVariationSettingsProperty -
fontWeightProperty -
foregroundEvent -
getCssFileName -
getMainEntry -
getNativeApplication -
getResources -
getRootView -
hasLaunched -
hasListeners -
heightProperty -
hintProperty -
horizontalAlignmentProperty -
inBackground -
ios -
isAndroid Gets a value indicating if the app is running on the Android platform.
isApple Gets a value indicating if the app is running on an Apple platform.
isIOS Gets a value indicating if the app is running on the iOS platform.
isUserInteractionEnabledProperty -
isVisionOS Gets a value indicating if the app is running on the iOS platform.
keyboardTypeProperty -
launchEvent -
layoutDirection -
layoutDirectionChanged -
layoutDirectionChangedEvent -
letterSpacingProperty -
lineHeightProperty -
loadAppCss -
lowMemoryEvent -
marginBottomProperty -
marginLeftProperty -
marginRightProperty -
marginTopProperty -
maxHeightProperty -
maxLengthProperty -
maxWidthProperty -
minHeightProperty -
minWidthProperty -
NativeWindowEvents Events emitted by a NativeWindow instance.
notify -
off -
on -
opacityProperty -
orientation -
orientationChangedEvent -
paddingBottomProperty -
paddingInternalProperty -
paddingLeftProperty -
paddingRightProperty -
paddingTopProperty -
perspectiveProperty -
placeholderColorProperty -
platformNames -
resetRootView -
resumeEvent -
returnKeyTypeProperty -
rotateProperty -
rotateXProperty -
rotateYProperty -
rowGapProperty -
run -
scaleXProperty -
scaleYProperty -
SceneEvents -
setAutoSystemAppearanceChanged -
setCssFileName -
setMaxRefreshRate -
setResources -
suspended -
suspendEvent -
systemAppearance -
systemAppearanceChanged -
systemAppearanceChangedEvent -
textAlignmentProperty -
textDecorationProperty -
textOverflowProperty -
textShadowProperty -
textStrokeProperty -
textTransformProperty -
translateXProperty -
translateYProperty -
uncaughtErrorEvent -
unsetValue Value specifying that Property should be set to its initial value.
updateTextTriggerProperty -
VALID_FONT_SCALES -
verticalAlignmentProperty -
visibilityProperty -
whiteSpaceProperty -
widthProperty -
WindowEvents Application-level events related to window management.
zIndexProperty -

Functions

Function Description
_hasPaddingSetNativeOverrides Whether a subclass overrides any of the per-side [padding*Property.setNative] handlers coreProto defines. An override owns padding application - the consolidated paddingInternal write must stand down, or it would apply padding around handlers designed to intercept it.
_resolveAnimationCurve -
_setResolver Used to set a global singular instance of ModuleNameResolver
action The action() method displays a action box that prompts the visitor to choose some action.
addTaggedAdditionalCSS -
addWeakEventListener Attaches a WeakEventListener.
alert The alert() method displays an alert box with a specified message.
animationTimingFunctionConverter -
booleanConverter -
confirm The confirm() method displays a dialog box with a specified message.
CSSType Specifies the type name for the instances of this View class, that is used when matching CSS type selectors.
eachDescendant Iterates through all child views (via visual tree) and executes a function.
fromObject Creates an Observable instance and sets its properties according to the supplied JavaScript object. param obj - A JavaScript object used to initialize nativescript Observable instance.
fromObjectRecursive Creates an Observable instance and sets its properties according to the supplied JavaScript object. This function will create new Observable for each nested object (expect arrays and functions) from supplied JavaScript object. param obj - A JavaScript object used to initialize nativescript Observable instance.
getAncestor Gets an ancestor from a given type.
getAndroidAccessibilityManager -
getCurrentFontScale -
getCurrentPage -
getFileAccess Returns FileSystemAccess, a shared singleton utility class to provide methods to access and work with the file system. This is used under the hood of all the file system apis in @nativescript/core and provided as a lower level convenience if needed.
getLastFocusedViewOnPage Find the last view focused on a page.
getNativeApp Get the current application instance.
getRootLayout -
getRootLayoutById -
getTransformedText -
getViewById Gets a child view by id.
isAccessibilityServiceEnabled Is Android TalkBack or iOS VoiceOver enabled?
isEmbedded Whether the app is embedded into a host project or standalone project
login The login() method displays a login dialog box that prompts the visitor for user name and password.
makeParser -
makeValidator -
parseCSSShadow Parse a string into ShadowCSSValues Supports any valid css box/text shadow combination.
parseCSSStroke Parse a string into StrokeCSSValues https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-text-stroke
parseKeyframeDeclarations -
profile Method decorator factory. It will intercept the method call and start and pause a timer before and after the method call. Works only if profiling is enabled.
profilingDisable Disables profiling.
profilingDumpProfiles Prints the timer for all methods instrumented with profile decorator.
profilingEnable Enables profiling.
profilingIsRunning Returns true if a timer is currently running.
profilingResetProfiles Resets the timers for all methods instrumented with profile decorator.
profilingStart Starts a timer with a specific name. Works only if profiling is enabled.
profilingStartCPU Starts android cpu profiling.
profilingStop Pauses a timer with a specific name. This will increase call count and accumulate time. Works only if profiling is enabled.
profilingStopCPU Stops android cpu profiling.
profilingTime Gets accurate system timestamp in ms.
profilingUptime Gets the uptime of the current process in milliseconds.
prompt The prompt() method displays a dialog box that prompts the visitor for input.
PseudoClassHandler -
querySelectorAll Gets a child view by selector.
removeTaggedAdditionalCSS -
removeWeakEventListener Removes a WeakEventListener.
resolveFileNameFromUrl -
sendAccessibilityEvent Android: helper function for triggering accessibility events
setActivityCallbacks -
setNativeApp This is called internally to set the native application instance. You typically do not need to call this directly. However, it's exposed for special case purposes, such as custom application initialization.
timeConverter -
updateAccessibilityProperties Update accessibility properties on nativeView

References

androidRegisteredReceivers

Renames and re-exports androidRegisterBroadcastReceiver


androidUnregisterBroadcastReceiver

Renames and re-exports androidRegisterBroadcastReceiver


iosAddNotificationObserver

Renames and re-exports androidRegisterBroadcastReceiver


iosNotificationObservers

Renames and re-exports androidRegisterBroadcastReceiver


iosRemoveNotificationObserver

Renames and re-exports androidRegisterBroadcastReceiver


sanitizeModuleName

Re-exports sanitizeModuleName