Function Namespace Biojs
Defined in: Biojs.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Biojs()
Main container of the BioJS library.
|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
Biojs.ancestor
Ancestor of the Biojs class (Object).
|
| <static> |
Biojs.console
Cross-browser console for debugging.
|
| <static> |
Biojs.version
Version of the Biojs class.
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
Biojs.addInstance(instance)
Register a Biojs instance.
|
|
addListener(eventType, actionPerformed)
Register a function under an event type in order to execute it whenever the event is triggered.
|
|
|
extend(source, value)
|
|
| <static> |
Biojs.extend(instance, interface)
Extend this class Biojs in order to create a new component.
|
| <static> |
Biojs.forEach(object, block, context)
|
| <static> |
Biojs.getGlobal(key)
Get a variable value from the DOM window.
|
|
getId()
|
|
| <static> |
Biojs.getInstance(id)
Get a Biojs instance by means of its id.
|
| <static> |
Biojs.implement()
|
|
listen(source, eventType, actionPerformed)
Connect this component with another by means listening its events.
|
|
|
raiseEvent(eventType, params)
Trigger the registered functions under an event type.
|
|
| <static> |
Biojs.registerGlobal(key, value)
Set a variable in the DOM window.
|
|
setEventHandlers(eventTypes)
Sets an event handler and an alias method for each string in the array eventTypes.
|
|
|
setOptions(options)
|
|
| <static> |
Biojs.toString()
Get string.
|
| <static> |
Biojs.uniqueId()
Get a unique identifier.
|
Function Namespace Detail
Biojs()
Main container of the BioJS library. It is the parent class for all the components.
Field Detail
<static>
Biojs.ancestor
Ancestor of the Biojs class (Object).
<static>
Biojs.console
Cross-browser console for debugging.
This is a shorcut for Biojs.Utils.console
<static>
Biojs.version
Version of the Biojs class.
Method Detail
<static>
Biojs.addInstance(instance)
Register a Biojs instance.
- Parameters:
- instance
addListener(eventType, actionPerformed)
Register a function under an event type in order to execute it whenever the event is triggered.
var listener = function(eventObj){
alert("Selected: "+eventObj.start+", end: "+ eventObj.end);
}
var mySequence = new Biojs.Sequence( {
sequence : "mlpglallllaawtaralevptdgnagllaepqiamfcgrlnmhmnvqngsgtktcidtkegilqy",
target : "#div0001",
format : 'CODATA',
id : 'P918283'
});
mySequence.addListener('onSelectionChanged', listener);
// HTML div tag with the id='div0001' must exist in the HTML document
- Parameters:
- {string} eventType
- The event to be listened.
- {function} actionPerformed
- The action to be executed whenever the event occurs. it
extend(source, value)
- Parameters:
- source
- value
<static>
{object}
Biojs.extend(instance, interface)
Extend this class Biojs in order to create a new component.
Biojs.MyComponent = Biojs.extend(
{ // instance
constructor: function(options) {
// constructor code here
},
opt: { target: "divId" },
eventTypes: [ "myEvent1", "myEvent2" ],
getVersion: function() {
return Biojs.MyComponent.VERSION;
}
},
{ // class interface
VERSION: "3.14.15"
});
alert(Biojs.MyComponent.VERSION);
- Parameters:
- {object} instance
- The subclass.
- {object} interface
- (optional) A second parameter passed to the extend method of a class defines the class interface.
- Returns:
- {object} SubClass The class with its own members and the inherited ones from Biojs.
<static>
Biojs.forEach(object, block, context)
- Parameters:
- object
- block
- context
<static>
Biojs.getGlobal(key)
Get a variable value from the DOM window.
- Parameters:
- key
getId()
<static>
Biojs.getInstance(id)
Get a Biojs instance by means of its id.
- Parameters:
- id
<static>
Biojs.implement()
listen(source, eventType, actionPerformed)
Connect this component with another by means listening its events.
var mySequence = new Biojs.Sequence( {
sequence : "mlpglallllaawtaralevptdgnagllaepqiamfcgrlnmhmnvqngsgtktcidtkegilqy",
target : "#div0001",
format : 'CODATA',
id : 'P918283'
});
var anotherSequence = new Biojs.Sequence({
sequence : "laawtaralevptmlpglallldgnagllaepqi",
target : "#div0002",
});
anotherSequence.listen(
mySequence,
"onSelectionChange",
function( eventObj ) {
anotherSequence.setSelection(eventObj.start, eventObj.end);
}
);
- Parameters:
- {Biojs} source
- The another component.
- {string} eventType
- The event to be listened.
- {function} actionPerformed
- The action to be executed whenever the event occurs. it
raiseEvent(eventType, params)
Trigger the registered functions under an event type.
Biojs.MyComponent = Biojs.extend({
// ...
// code before the event
this.raiseEvent('onSelectionChanged', {start : start, end : end});
// code after the event
// ...
});
- Parameters:
- {string} eventType
- The event to be raised.
- {Object} params
- The values to be included into Biojs.Event object.
<static>
Biojs.registerGlobal(key, value)
Set a variable in the DOM window.
- Parameters:
- key
- value
setEventHandlers(eventTypes)
Sets an event handler and an alias method for each string in the array eventTypes.
This method is executed automatically before constructing an instance, using the eventTypes array
that should be defined as member of subclass. Then, the resulting instance will have methods
named in the form instance.≶eventName>(actionPerformed) for all eventTypes.
- Parameters:
- {string[]} eventTypes
- Array of names of the events to be set.
setOptions(options)
- Parameters:
- options
<static>
Biojs.toString()
Get string.
<static>
Biojs.uniqueId()
Get a unique identifier. It is useful to assign the instance' id