Skip to content

Plugin Instances

Daniel Hindi edited this page Jan 9, 2018 · 9 revisions

buildfire.pluginInstance

This is an object within the buildfire singleton that is for retrieving other plugins instances that are added to the current app context.

What is a plugin instance?

a plugin instance is a new occurrence of a plugin type. For example you can have installed one Text Plugin but have two instances of it.

Typically this is used in launcher or folder type plugins. These types of plugins help the user navigate to other plugins.

  • Gotchya: Be careful when saving the plugin instances data to your local datastore. The instance may be deleted or modified after your save. Use Dynamic Data Injection to get latest data

Methods

buildfire.pluginInstance.showDialog(options, callback)

Used typically on the control side. This method will display a dialog that allows the user to search and select one or many plugins

  • options is an object that consists of the following properties
    • skipPluginInstances : boolean by default it will be false , which shows create plugin instance dialog directly. without showing select plugin instances dialog .
    • hideAddPlugin : boolean by default false , which hide the add plugin button on the plugin instances dialog .
  • callback is a function that is called when the dialog is complete
    • 'error': Error object
    • 'instances': array of selected plugin instances
      • folderName: string
      • iconUrl: string url of plugin instance icon
      • instanceId: string
      • pluginTypeId: string
      • pluginTypeName: string with the plugin type name
      • title:string with the title of the plugin

example

buildfire.pluginInstance.showDialog({
    prop1:""
},function(error, instances){
    if(err)
        console.error(err);
    else if (instances.length > 0)
        console.log(instances[0].title)
});

buildfire.pluginInstance.get(instanceId, callback)

Will fetch a plugins based on instanceId that were passed in

  • instanceId representing plugin instance id
  • callback is a function that is called with the results

example

buildfire.pluginInstance.get(['123','321'],function(error,instances){

});

buildfire.pluginInstance.search(options, callback)

Will search all the plugins and return results paginated

  • options an object dictating the search criteria
    • title : string that will be regex'ed on title
    • pageIndex : integer that start with page zero
    • pageSize : max size of 20
  • callback is a function that is called with the results

example

buildfire.pluginInstance.search({},function(error, instances){

});

buildfire.pluginInstance.showCreatePluginInstancesDialog(options, callback)

Used typically on the control side. This method will display a dialog that allows the user to add a new plugin instance of a specific type and then return that plugin instance to the caller

  • options is an object that consists of the following properties
    • prop1 : property description
    • prop1 : property description
  • callback is a function that is called when the dialog is complete

example

buildfire.pluginInstance.showCreatePluginInstancesDialog({
    prop1:""
},function(error, instance){

});

Clone this wiki locally