<abstract> new Component()
Defines components abstract class
Example
WebPDF.Toolbar.getRegistry().registerComponent('name', { 'constructor': function(options){ this.superclass.call(this, options); this.text = options.text; }, methods: { doActive: function() { this.$element.css('background', '#d7bae7'); }, doDeactive: function() { this.$element.css('background', 'transparent'); }, mounted: function() { var self = this; this.$element.click(function(){ self.trigger('handle'); }); }, render: function(){ return $('<button>').text(this.text); } } });
Methods
-
destroy()
-
destroy this component
-
<protected> doActive()
-
todo sth. on active
-
<protected> doDeactive()
-
todo sth. on deactive
-
<protected> doDisable()
-
todo sth. on disable
-
<protected> doEnable()
-
todo sth. on enable
-
getChildByName(name)
-
find child by name
Parameters:
Name Type Description name
string child component name
Returns:
-
hide()
-
Hide this component
-
mounted($element)
-
called after the element has been mounted
Parameters:
Name Type Description $element
jQuery rendered element
-
off(eventName [, eventHandler])
-
Remove an event handler;
Parameters:
Name Type Argument Description eventName
string event name
eventHandler
string <optional>
handler of event
Returns:
- Type
- this
-
on(eventName, eventHandler)
-
Attach a handler to an event to the component.
Parameters:
Name Type Description eventName
string eventHandler
function Returns:
- Type
- this
-
one(eventName, eventHandler)
-
Attach a handler to an event to the components, The handler is executed at most once per component per event type.
Parameters:
Name Type Description eventName
string eventHandler
function Returns:
- Type
- this
-
<protected> render()
-
This function allowing you to leverage the full programmatic power of JavaScript to create your component element.
Returns:
- Type
- JQuery
-
show()
-
Show this component
-
trigger(eventName, data)
-
Trigger an event manually
Parameters:
Name Type Description eventName
string event name
data
Array.<object> event data
Returns:
- Type
- this