Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

dhayab/TitaniumNotification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Notification is a script for Appcelerator Titanium Mobile. It allows you to display a modal, visual, notification on screen for multiple purposes.

Using an image A spinner with a label

Usage

Include Notification.js in your document: Ti.include('path/to/Notification.js');

To use Notification just call the method: Notification.show(...);

Notification.show(...) needs a parameters dictionary with the following values.
parent: The container where the notification will be shown
label (optional): The text displayed on the notification
spinner (optional): Shows an ActivityIndicator with the notification
image (optional): The url to the image that will be shown with the notification
duration (optional): Seconds before the notification will hide itself
onclick (optional): A method to call when a tap is detected on the notification

Example

Notification.show({
  parent: win,
  label: 'Loading...',
  spinner: true,
  onclick: function ( ) {
    alert('Loading canceled!');
  }
});

Other methods

Notification.hide(...) removes a notification from the screen.
Notification.hide({ parent: win });

Notification.setLabel('Some text') changes the label of a notification.

Notification.setDefaults(...) sets default values to be used for all notifications. They are saved in NSDefaults, and can be overrided when specifying other values in Notification.show(...). You can reset the configuration by calling this method without any parameter.
Notification.setDefaults({ size: 150, label: L('Please wait...'), spinner: true });

About

A Titanium Mobile script that provides visual notifications for iOS apps.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published