Class: Amoeba

Amoeba

new Amoeba(parent, p)

Creates a new Amoeba
Parameters:
Name Type Description
parent Amoeba The parent amoeba
p String Path for current amoeba
Version:
  • 0.2.0
Author:
  • Maksym Pomazan
Source:

Members

vacuole

Method synonim for path method
Source:

Methods

as(Object) → {Amoeba}

Route amoeba path to Object
Parameters:
Name Type Description
Object Object for route
Source:
Returns:
self for chain execution
Type
Amoeba

emit(event, data) → {Amoeba}

Emit event
Parameters:
Name Type Description
event String Event to emit
data Object Event data
Source:
Returns:
self for chain execution
Type
Amoeba

handlers(type, path) → {Array}

Find handlers by type or by type and path
Parameters:
Name Type Description
type String Type of handle
path String Used path
Source:
Returns:
All founded handlers
Type
Array

invoke(method, params, callback) → {Amoeba}

Invoke method
Parameters:
Name Type Argument Description
method String Method name
params Object <optional>
Object or Array
callback function <optional>
Callback function for async methods
Source:
Returns:
self for chain execution
Type
Amoeba

on(event, callback) → {Amoeba}

Add event listener
Parameters:
Name Type Description
event String Event to listen. Can be mask.
callback function Callback function
Source:
Returns:
self for chain execution
Type
Amoeba

path(p) → {Amoeba}

Method return new Amoeba accroding path
Parameters:
Name Type Description
p String Path
Source:
Returns:
new created amoeba
Type
Amoeba
Example
var amoeba = new Amoeba();
amoeba.path("chat").on("message", function(){});

root() → {Amoeba}

Method return root amoeba
Source:
Returns:
The root amoeba
Type
Amoeba

use(type, handler) → {Amoeba}

Add middleware logic
Parameters:
Name Type Description
type String Type of handler. before_invoke | after_invoke | before_event
handler function Handler
Source:
Returns:
self for chain execution
Type
Amoeba