-
Notifications
You must be signed in to change notification settings - Fork 84
How to use Notifications
o5faruk edited this page May 2, 2021
·
25 revisions
This sdk documentation is deprecated and will not be updated. Check out our new docs at https://sdk.buildfire.com/docs/notifications/
This function only available on widget section
-
times: The number of times to repeat the beep. (Number) callback(err, data)
This function only available on widget section
-
milliseconds: Milliseconds to vibrate the device. (Number). iOS only supports 1000 Milliseconds callback(err, data)
This function only available on widget section
-
options: object-
title: string -
message: string (optional) -
buttonLabels: Array of strings specifying button labels (Array) (Optional, defaults to ["OK","Cancel"]) -
defaultText: Default textbox input value (String) (Optional, Default: empty string)
-
callback(err, data)
The following section of Notifications API is deprecated. Please use Dialog API.
The alert method displays an alert popup with a specified message and an OK button. An alert popup is often used if you want to make sure information comes through to the user.
-
options: object-
title: string (optional), by default 'Alert' -
message: string -
size: string (optional), by default 'sm', sizes available:smsmall popup,mdmedium popup ,lglarge popup -
okButton: object (optional)-
text: string (optional), button text, by default the value isOk -
key: string (optional), button key, by default the value isok, to be use in the callback to know what button the user clicked -
type: string (optional), to be use to show the button style, by default the value is 'primary'. types available:default,primary,success,info,warning,danger
-
-
-
callback(err, data): callback function after the end user clicked on button. Data contains the selected button object ex:{selectedButton:{text:"Ok", key:'ok'}}
buildfire.notifications.alert({
title:"Access Deined"
,message:"You don't have the permission to access this section!"
,okButton: {text:'Ok'}
},function(e,data){
if(e) console.error(e);
if(data) console.log(data);
});
The confirm method displays a confirm popup with a specified message, along with an OK and a Cancel button. A confirm popup is often used if you want the user to verify or accept something.
-
options: object-
title: string (optional), by default 'Are you sure?' -
message: string -
size: string (optional), by default 'sm', sizes available:smsmall popup,mdmedium popup ,lglarge popup -
confirmButton: object (optional)-
text: string (optional), button text, by default the value isConfirm -
key: string (optional), button key, by default the value isconfirm, to be use in the callback to know what button the user clicked -
type: string (optional), to be use to show the button style, by default the value is 'primary'. types available:default,primary,success,info,warning,danger
-
-
cancelButton: object (optional)-
text: string (optional), button text, by default the value isCancel -
key: string (optional), button key, by default the value iscancel, to be use in the callback to know what button the user clicked -
type: string (optional), to be use to show the button style, by default the value is 'default'. types available:default,primary,success,info,warning,danger
-
-
-
callback(err, data): callback function after the end user clicked on button. Data contains the selected button object ex:{selectedButton:{text:"Confirm", key:'confirm'}}
buildfire.notifications.confirm({
title:"Are you sure?"
,message:"Are you sure to delete this record?"
,confirmButton: {text: 'Yes', key:'yes', type: 'danger'}
,cancelButton: {text: 'No', key:'no', type: 'default'}
},function(e,data){
if(e) console.error(e);
if(data) console.log(data);
});
This function only available on Control section of your plugin, The showDialog method displays a popup with a specified title and message. A showDialog popup is used if you want to build a popup with generic buttons.
-
options: object-
title: string -
message: string (optional) -
size: string (optional), by default 'sm', sizes available:smsmall popup,mdmedium popup ,lglarge popup -
buttons: array of objects (optional)-
text: string -
key: string, to be use in the callback to know what button the user clicked -
type: string (optional), to be use to show the button style, by default the value is 'default'. types available:default,primary,success,info,warning,danger
-
-
-
callback(err, data): callback function after the end user clicked on button. Data contains the selected button object ex:{selectedButton:{text:"button text", key:'button key'}}
buildfire.notifications.showDialog({
title:"options available"
,message:"Please select the t-shirt size"
,buttons: [{text: 'Small', key:'small', type: 'default'}, {text: 'Medium', key:'medium', type: 'default'}, {text: 'Large', key:'large', type: 'default'}]
},function(e,data){
if(e) console.error(e);
if(data) console.log(data);
});