-
Notifications
You must be signed in to change notification settings - Fork 56
Internal jBinary Methods
Ingvar Stepanyan edited this page Apr 30, 2014
·
4 revisions
-
getType(type)
: Returns preconfiguredjBinary.Type
instance from given descriptor.
// Example:
var jbType = binary.getType(['string', 30]);
-
getContext(filter)
: Get object context specified byfilter
. Possible filter types:- not set - current context will be returned.
- number -
filter
will be used as relative depth (0 is current context, 1 for parent and so on). - string - will look for closest context that contains property name equal to
filter
. - function - will be used as boolean function (
true
to stop) while bubbling up through contexts.
// Example:
var currentContext = binary.getContext(); // current object that value belongs to
var parentContext = binary.getContext(1); // one level up
var contextWithID = binary.getContext('id'); // first context with "id" property (bubbling up)
var contextWithID1 = binary.getContext(function (context) { return context.id === 1 }); // first context that matches custom condition
-
inContext(newContext, callback)
: Steps into given context and executes function inside it.