Namespace: conbo

conbo

ConboJS is a lightweight MVx application framework for JavaScript featuring dependency injection, context and encapsulation, data binding, command pattern and an event model which enables callback scoping and consistent event handling All ConboJS classes, methods and properties live within the conbo namespace
Source:

Classes

Application
AttributeBindings
BindingUtils
Class
Command
ConboClass
ConboEvent
Context
DataEvent
ElementProxy
Event
EventDispatcher
EventProxy
Glimpse
Hash
HeadlessApplication
HttpService
ItemRenderer
List
LocalHash
LocalList
MutationObserver
Namespace
RemoteHash
RemoteList
Router
View

Members

(static) bindingUtils :conbo.BindingUtils

Default instance of the BindingUtils data-binding utility class
Type:
Source:

(static) conbo :conbo

Internal reference to self for use with ES2015 import statements
Type:
Source:
Example
import { conbo } from 'conbo';

(static, constant) CONTENT_TYPE_FORM :string

Constant for form URL-encoded content type
Type:
  • string
Source:

(static, constant) CONTENT_TYPE_JSON :string

Constant for JSON content type
Type:
  • string
Source:

(static, constant) DATA_TYPE_JSON :string

Constant for JSON data type
Type:
  • string
Source:

(static, constant) DATA_TYPE_SCRIPT :string

Constant for script data type type
Type:
  • string
Source:

(static, constant) DATA_TYPE_TEXT :string

Constant for text data type type
Type:
  • string
Source:

(static) IDataRenderer :object

Interface class for data renderers, for example an item renderer for use with the cb-repeat attribute
Type:
  • object
Author:
  • Neil Rackett
Source:

(static) IInjectable

Partial class that enables the ConboJS framework to add the application specific Context class instance and inject specified dependencies (properties of undefined value which match registered singletons); should be used via the Class.implement method
Author:
  • Neil Rackett
Source:
Examples
var C = conbo.Class.extend().implement(conbo.IInjectable);
conbo.defineValues(classInstance, conbo.IInjectable);

(static) isNode :boolean

Is this script being run using Node.js?
Type:
  • boolean
Source:

(static) isSupported :boolean

Is Conbo supported by the current browser?
Type:
  • boolean
Source:

(static) logEnabled :boolean

Should Conbo output data to the console when calls are made to loggin methods?
Type:
  • boolean
Source:
Example
conbo.logEnabled = false;
conbo.log('Blah!'); // Nothing will be displayed in the console

(static, constant) NAMESPACE_DEFAULT :string

Default application namespace
Type:
  • string
Source:

(static) VERSION :string

The current ConboJS version number in the format major.minor.build
Type:
  • string
Source:

Methods

(static) addLeadingZero(number, minLengthopt) → {string}

Add a leading zero to the specified number and return it as a string
Parameters:
Name Type Attributes Default Description
number number The number to add a leading zero to
minLength number <optional>
2 the minumum length of the returned string (default: 2)
Source:
Returns:
Type
string

(static) assign(target, …source) → {Object}

Copies all of the enumerable values from one or more objects and sets them on another, without affecting the target object's property descriptors. Unlike Object.assign(), the properties copied are not limited to own properties. Unlike conbo.defineValues, assign only sets the values on the target object and does not destroy and redifine them.
Parameters:
Name Type Attributes Description
target Object Object to copy properties to
source Object <repeatable>
Object to copy properties from
Source:
Returns:
Type
Object
Example
conbo.assign({id:1}, {get name() { return 'Arthur'; }}, {get age() { return 42; }});
=> {id:1, name:'Arthur', age:42}

(static) Bindable(target, key)

TypeScript / ES2017 decorator to make a property bindable
Parameters:
Name Type Description
target any The target object
key string The name of the property
Source:

(static) bindAll(obj) → {Object}

Bind one or more of an object's methods to that object. Remaining arguments are the method names to be bound. If no additional arguments are passed, all of the objects methods that are not native or accessors are bound to it.
Parameters:
Name Type Description
obj Object Object to bind methods to
Source:
Returns:
Type
Object

(static) callLater(func, scopeopt) → {conbo}

Calls a function at the start of the next animation frame, useful when updating multiple elements in the DOM
Parameters:
Name Type Attributes Description
func function Function to call
scope Object <optional>
The scope in which to call the function
Source:
Returns:
Type
conbo

(static) clone(obj) → {Object}

Create a (shallow-cloned) duplicate of an object.
Parameters:
Name Type Description
obj Object Object to clone
Source:
Returns:
Type
Object

(static) cloneProperty(source, sourceName, target, targetNameopt) → {conbo}

Copies a property, including defined properties and accessors, from one object to another
Parameters:
Name Type Attributes Description
source Object Source object
sourceName string Name of the property on the source
target Object Target object
targetName string <optional>
Name of the property on the target (default: sourceName)
Source:
Returns:
Type
conbo

(static) compact(array) → {Array}

Trim out all falsy values from an array.
Parameters:
Name Type Description
array Array The array to trim
Source:
Returns:
Type
Array

(static) compileTemplate(template, defaultsopt) → {function}

Converts a template string into a pre-populated templating method that can be evaluated for rendering.
Parameters:
Name Type Attributes Description
template string A string containing property names in {{moustache}} or ${ES2015} format to be replaced with property values
defaults Object <optional>
An object containing default values to use when populating the template
Source:
Returns:
A function that can be called with a data object, returning the populated template
Type
function

(static) contains(obj, target) → {boolean}

Determine if the array or object contains a given value (using `===`).
Parameters:
Name Type Description
obj Object The list to iterate
target function The value to match
Source:
Returns:
Type
boolean

(static) decodeEntities(string) → {string}

Decodes all of the HTML entities contained in an string, replacing them with special characters, making it safe for use in plain text documents
Parameters:
Name Type Description
string string String to dencode
Source:
Returns:
Type
string

(static) defer(func, scopeopt) → {number}

Defers a function, scheduling it to run after the current call stack has cleared.
Parameters:
Name Type Attributes Description
func function Function to call
scope Object <optional>
The scope in which to call the function
Source:
Returns:
ID that can be used with clearInterval
Type
number

(static) defineBindableValues(obj, …source) → {Object}

Define bindable values on the given object using the property names and of the passed-in object(s), destroying and overwriting the target's property descriptors and values in the process
Parameters:
Name Type Attributes Description
obj Object Object to define properties on
source * <repeatable>
Objects containing properties to defined
Source:
Returns:
Type
Object

(static) defineDefaults(target, …obj) → {Object}

Fill in an object's missing properties by cloning the properties of the source object(s) onto the target object, overwriting the target's property descriptors
Parameters:
Name Type Attributes Description
target Object Object to populate
obj Object <repeatable>
Objects containing default values
Source:
See:
Returns:
Type
Object

(static) defineValues(obj, …source) → {Object}

Define the values of the given object by cloning all of the properties of the passed-in object(s), destroying and overwriting the target's property descriptors and values in the process
Parameters:
Name Type Attributes Description
obj Object Object to define properties on
source * <repeatable>
Objects containing properties to define
Source:
See:
  • conbo.setValues
Returns:
Type
Object

(static) difference(…array) → {Array}

Take the difference between one array and a number of other arrays. Only the elements present in just the first array will remain.
Parameters:
Name Type Attributes Description
array array <repeatable>
Arrays of compare
Source:
Returns:
Type
Array

(static) encodeEntities(string) → {string}

Encodes all of the special characters contained in a string into HTML entities, making it safe for use in an HTML document
Parameters:
Name Type Description
string string String to encode
Source:
Returns:
Type
string

(static) error(…values) → {void}

Add an error log message to the console
Parameters:
Name Type Attributes Description
values * <repeatable>
Values to display in the console
Source:
Returns:
Type
void

(static) every(obj, predicate, scopeopt) → {boolean}

Determine whether all of the elements match a truth test. Delegates to native `every` if available.
Parameters:
Name Type Attributes Description
obj Object The list to iterate
predicate function Function that tests each value, returning true or false
scope Object <optional>
The scope the predicate function should run in
Deprecated:
  • Use Array.prototype.every
Source:
Returns:
Type
boolean

(static) filter(obj, predicate, scopeopt) → {Array}

Return all the elements that pass a truth test. Delegates to native `filter` if available.
Parameters:
Name Type Attributes Description
obj Object The list to iterate
predicate function Function that tests each value, returning true or false
scope Object <optional>
The scope the predicate function should run in
Deprecated:
  • Use Array.prototype.filter
Source:
Returns:
Type
Array

(static) find(obj, predicate, scopeopt) → {*}

Return the first value which passes a truth test
Parameters:
Name Type Attributes Description
obj Object The list to iterate
predicate function Function that tests each value, returning true or false
scope Object <optional>
The scope the predicate function should run in
Source:
Returns:
Type
*

(static) findIndex(obj, predicate, scopeopt) → {number}

Return the index of the first value which passes a truth test
Parameters:
Name Type Attributes Description
obj Object The list to iterate
predicate function Function that tests each value, returning true or false
scope Object <optional>
The scope the predicate function should run in
Source:
Returns:
Type
number

(static) flatten(array) → {Array}

Flatten out an array, either recursively (by default), or just one level.
Parameters:
Name Type Description
array Array The array to flatten
Source:
Returns:
Type
Array

(static) forEach(obj, iterator, scopeopt) → {void}

Handles objects, arrays, lists and raw objects using a for loop (because tests show that a for loop can be twice as fast as a native forEach). Return `false` to break the loop.
Parameters:
Name Type Attributes Description
obj Object The list to iterate
iterator function Iterator function with parameters: item, index, list
scope Object <optional>
The scope the iterator function should run in
Source:
Returns:
Type
void

(static) formatCurrency(number, symbolopt, suffixedopt, decimalsopt, decimalPointopt, thousandsSeparatoropt) → {string}

Format a number as a currency
Parameters:
Name Type Attributes Description
number number
symbol string <optional>
suffixed boolean <optional>
decimals number <optional>
decimalPoint string <optional>
thousandsSeparator string <optional>
Source:
Returns:
Type
string

(static) formatNumber(number, decimalsopt, decimalPointopt, thousandsSeparatoropt) → {string}

Format a number using the selected number of decimals, using the provided decimal point, thousands separator
Parameters:
Name Type Attributes Default Description
number number
decimals number <optional>
0 default: 0
decimalPoint string <optional>
. default: '.'
thousandsSeparator string <optional>
, default: ','
Source:
See:
Returns:
Formatted number
Type
string

(static) functions(obj, deepopt, includeAccessors) → {Array}

Extends Object.keys to retrieve the names of an object's enumerable functions
Parameters:
Name Type Attributes Description
obj Object Object to get keys from
deep boolean <optional>
Retrieve keys from further up the prototype chain?
includeAccessors boolean Whether or not to include accessors that contain functions (default: false)
Source:
See:
Returns:
Type
Array

(static) getPropertyDescriptor(obj, propName) → {Object}

Extends Object.getOwnPropertyDescriptor to return a property descriptor for a property of a given object, regardless of where it is in the prototype chain
Parameters:
Name Type Description
obj Object Object containing the property
propName string Name of the property
Source:
Returns:
Type
Object

(static) getPropertyNames(obj, deepopt) → {Array}

Extends Object.getOwnPropertyNames to retrieve the names of every property of an object, regardless of whether it's enumerable or unenumerable
Parameters:
Name Type Attributes Description
obj Object Object to get keys from
deep boolean <optional>
Retrieve keys from further up the prototype chain?
Source:
Returns:
Type
Array

(static) getPublicVariableNames(obj, deepopt) → {Array}

Extends Object.getOwnPropertyNames to retrieves the names of every public variable of an object, regardless of whether it's enumerable or unenumerable
Parameters:
Name Type Attributes Description
obj Object Object to get keys from
deep boolean <optional>
Retrieve keys from further up the prototype chain?
Source:
See:
Returns:
Type
Array

(static) getValue(obj, propName, caseSensitiveopt) → {*}

Returns the value of the property matching the specified name, optionally searching for a case insensitive match. This is useful when extracting response headers, where the case of properties such as "Content-Type" cannot always be predicted
Parameters:
Name Type Attributes Default Description
obj Object The object containing the property
propName string The property name
caseSensitive boolean <optional>
true Whether to search for a case-insensitive match (default: true)
Source:
Returns:
The value of the specified property
Type
*

(static) getVariableNames(obj, deepopt) → {Array}

Extends Object.getOwnPropertyNames to retrieves the names of every variable of an object, regardless of whether it's enumerable or unenumerable
Parameters:
Name Type Attributes Description
obj Object Object to get keys from
deep boolean <optional>
Retrieve keys from further up the prototype chain?
Source:
See:
Returns:
Type
Array

(static) guid() → {string}

Generates a version 4 RFC4122 UUID
Source:
Returns:
Type
string

(static) has(obj, key) → {boolean}

Shortcut function for checking if an object has a given property directly on itself (in other words, not on a prototype).
Parameters:
Name Type Description
obj Object Object
key string Property name
Deprecated:
  • Use Object.prototype.hasOwnProperty
Source:
Returns:
Type
boolean

(static) httpRequest(urlOrOptions, data, method) → {Promise}

HTTP Request Sends data to and/or loads data from a URL; advanced requests can be made by passing a single options object, roughly analogous to the jQuery.ajax() settings object plus `resultClass` and `makeObjectsBindable` properties; or by passing URL, data and method parameters.
Parameters:
Name Type Description
urlOrOptions string | object URL string or Object containing URL and other settings for the HTTP request
data Object Data to be sent with request (ignored when using options object)
method string HTTP method to use, e.g. "GET" or "POST" (ignored when using options object)
Source:
See:
Returns:
Type
Promise
Examples
conbo.httpRequest("http://www.foo.com/bar", {user:1}, "GET");
conbo.httpRequest({url:"http://www.foo.com/bar", data:{user:1}, method:"GET", headers:{'X-Token':'ABC123'}});

(static) identity(obj) → {*}

Keep the identity function around for default iterators.
Parameters:
Name Type Description
obj * Value to return
Source:
Returns:
Type
*

(static) implement(obj, …source) → {Object}

Fill in missing values on an object by setting the property values on the target object, without affecting the target's property descriptors
Parameters:
Name Type Attributes Description
obj Object Object to populate
source Object <repeatable>
Objects containging default values
Source:
Returns:
Type
Object

(static) indexOf(obj, item) → {number}

Returns the index of the first instance of the specified item in the list
Parameters:
Name Type Description
obj Object The list to search
item Object The value to find the index of
Deprecated:
  • Use Array.prototype.indexOf
Source:
Returns:
Type
number

(static) info(…values) → {void}

Add information to the console
Parameters:
Name Type Attributes Description
values * <repeatable>
Values to display in the console
Source:
Returns:
Type
void

(static) initDom(namespace, rootElopt)

Initialize Applications in the DOM using the specified namespace By default, Conbo scans the entire DOM, but you can limit the scope by specifying a root element
Parameters:
Name Type Attributes Description
namespace conbo.Namespace
rootEl Element <optional>
Top most element to scan
Source:

(static) Inject(target, key)

TypeScript / ES2017 decorator to prepare a property for injection
Parameters:
Name Type Description
target any The target object
key string The name of the property
Source:

(static) instanceOf(obj, clazz) → {boolean}

Performs a comparison of an object against a class, returning true if the object is an an instance of the specified class. Unlike the native instanceof, however, this method works with both native and user defined classes.
Parameters:
Name Type Description
obj Object The class instance
clazz conbo.Class | function The class to compare against
Source:
Returns:
Type
boolean
Examples
var b = conbo.instanceOf(69, String);
var b = conbo.instanceOf(user, UserClass);

(static) intersection(…array) → {Array}

Produce an array that contains every item shared between all the passed-in arrays.
Parameters:
Name Type Attributes Description
array Array <repeatable>
Arrays of values
Source:
Returns:
Type
Array

(static) invoke(obj, method) → {Array}

Invoke a method (with arguments) on every item in a collection.
Parameters:
Name Type Description
obj Object The list to iterate
method function Function to invoke on every item
Source:
Returns:
Type
Array

(static) is(obj, classOrInterface, strictopt) → {boolean}

Performs a comparison of an object against a class or interface, returning true if the object is an an instance of the specified class or an implementation of the specified interface
Parameters:
Name Type Attributes Default Description
obj Object The object to compare
classOrInterface conbo.Class | object The class or pseudo-interface to compare against
strict boolean <optional>
true Perform a strict interface comparison (default: true)
Source:
Returns:
Type
boolean
Examples
var b = conbo.is(user, UserClass);
var b = conbo.is(user, IUser);
var b = conbo.is(user, partial, false);

(static) isAccessor(Object, The) → {boolean}

Is the specified property an accessor (defined using a getter and/or setter)?
Parameters:
Name Type Description
Object Object containing the property
The string name of the property
Source:
Returns:
Type
boolean

(static) isArguments(obj) → {boolean}

Is the specified object Arguments?
Parameters:
Name Type Description
obj Object The object to test
Source:
Returns:
Type
boolean

(static) isArray(obj) → {boolean}

Is a given value an array? Delegates to ECMA5's native Array.isArray
Parameters:
Name Type Description
obj Object Value that might be an Array
Deprecated:
  • Use Array.isArray
Source:
Returns:
Type
boolean

(static) isBoolean(obj) → {boolean}

Is a given value a boolean?
Parameters:
Name Type Description
obj Object Value that might be a Boolean
Source:
Returns:
Type
boolean

(static) isClass(value, classReferenceopt) → {boolean}

Is the value a Conbo class?
Parameters:
Name Type Attributes Description
value any Value that might be a class
classReference class <optional>
The Conbo class that the value must match or be an extension of
Source:
Returns:
Type
boolean

(static) isDate(obj) → {boolean}

Is the specified object a Date?
Parameters:
Name Type Description
obj Object The object to test
Source:
Returns:
Type
boolean

(static) isElement(obj) → {boolean}

Is a given value a DOM element?
Parameters:
Name Type Description
obj Object Value that might be a DOM element
Source:
Returns:
Type
boolean

(static) isEmpty(value) → {boolean}

Is the value empty? Based on PHP's `empty()` method
Parameters:
Name Type Description
value any Value that might be empty
Source:
Returns:
Type
boolean

(static) isEqual(a, b) → {boolean}

Perform a deep comparison to check if two objects are equal.
Parameters:
Name Type Description
a Object Object to compare
b Object Object to compare
Source:
Returns:
Type
boolean

(static) isFinite(obj) → {boolean}

Is a given object a finite number?
Parameters:
Name Type Description
obj Object Value that might be finite
Source:
Returns:
Type
boolean

(static) isFunc(obj, propName) → {boolean}

Detects whether the specified property was defined as a function, meaning accessors containing functions are excluded
Parameters:
Name Type Description
obj Object Object containing the property
propName string The name of the property
Source:
See:
Returns:
true if it's a function
Type
boolean

(static) isFunction(obj) → {boolean}

Is the specified object a Function?
Parameters:
Name Type Description
obj Object The object to test
Source:
Returns:
Type
boolean

(static) isIterable(obj) → {boolean}

Can the value be iterated using a for loop? For example an Array, Arguments, ElementsList, etc.
Parameters:
Name Type Description
obj any Object that might be iterable
Source:
Returns:
Type
boolean

(static) isNaN(obj) → {boolean}

Is the given value `NaN`? (NaN is the only number which does not equal itself).
Parameters:
Name Type Description
obj Object Value that might be NaN
Source:
Returns:
Type
boolean

(static) isNative(func) → {boolean}

Is the specified function native?
Parameters:
Name Type Description
func function The function that might be native
Source:
Returns:
true if it's native, false if it's user defined
Type
boolean

(static) isNull(obj) → {boolean}

Is a given value equal to null?
Parameters:
Name Type Description
obj Object Value that might be null
Source:
Returns:
Type
boolean

(static) isNumber(obj) → {boolean}

Is the specified object a Number?
Parameters:
Name Type Description
obj Object The object to test
Source:
Returns:
Type
boolean

(static) isNumeric(value) → {boolean}

Is the given value numeric? i.e. a number of a string that can be coerced into a number
Parameters:
Name Type Description
value * Value that might be numeric
Source:
Returns:
Type
boolean

(static) isObject(obj) → {boolean}

Is a given variable an object?
Parameters:
Name Type Description
obj Object Value that might be an Object
Source:
Returns:
Type
boolean

(static) isPlainObject(obj) → {boolean}

Is a given variable a plain object (i.e. not an instance of anything)?
Parameters:
Name Type Description
obj Object Value that might be a plain Object
Source:
Returns:
Type
boolean

(static) isRegExp(obj) → {boolean}

Is the specified object a RegExp (regular expression)?
Parameters:
Name Type Description
obj Object The object to test
Source:
Returns:
Type
boolean

(static) isString(obj) → {boolean}

Is the specified object a String?
Parameters:
Name Type Description
obj Object The object to test
Source:
Returns:
Type
boolean

(static) isUndefined(obj) → {boolean}

Is a given variable undefined?
Parameters:
Name Type Description
obj Object Value that might be undefined
Source:
Returns:
Type
boolean

(static) jsonify(obj) → {*}

Prepare data for submission to web services. If no toJSON method is present on the specified Object, this method returns a version of the object that can easily be converted into JSON, made up of its public properties, with all functions, unenumerable and private properties removed. This method can be assigned to an Object or Array as the toJSON method for use with JSON.stringify().
Parameters:
Name Type Description
obj * Object to convert
Source:
Returns:
JSON ready version of the object
Type
*
Example
conbo.jsonify(myObj); // Defers to myObj.toJSON() if it exists
conbo.jsonify.call(myObj); // Ignores myObj.toJSON(), even if it exists
myObj.toJSON = conbo.jsonify; // Assign this method to your Object

(static) keys(obj, deepopt) → {Array}

Extends Object.keys to retrieve the names of an object's enumerable properties
Parameters:
Name Type Attributes Description
obj Object Object to get keys from
deep boolean <optional>
Retrieve keys from further up the prototype chain?
Source:
Returns:
Type
Array

(static) last(array, n, guardopt) → {Object}

Get the last element of an array. Passing n will return the last N values in the array. The guard check allows it to work with `conbo.map`.
Parameters:
Name Type Attributes Description
array Array The array to slice
n function The number of elements to return (default: 1)
guard Object <optional>
Optional
Source:
Returns:
Type
Object

(static) lastIndexOf(obj, item) → {number}

Returns the index of the last instance of the specified item in the list
Parameters:
Name Type Description
obj Object The list to search
item Object The value to find the index of
Deprecated:
  • Use Array.prototype.lastIndexOf
Source:
Returns:
Type
number

(static) loadCss(url, mediaopt) → {Promise}

Loads a CSS file and applies it to the DOM
Parameters:
Name Type Attributes Default Description
url string The CSS file's URL
media string <optional>
all The media attribute (defaults to 'all')
Source:
Returns:
Type
Promise

(static) loadScript(url, scopeopt) → {Promise}

Load a JavaScript file and executes it
Parameters:
Name Type Attributes Description
url string The JavaScript file's URL
scope Object <optional>
The scope in which to run the loaded script
Source:
Returns:
Type
Promise

(static) log(…values) → {void}

Add a log message to the console
Parameters:
Name Type Attributes Description
values * <repeatable>
Values to display in the console
Source:
Returns:
Type
void

(static) makeAllBindable(obj, propNamesopt) → {conbo}

Makes all existing properties of the specified object bindable, and optionally creates additional bindable properties for each of the property names in the propNames array
Parameters:
Name Type Attributes Description
obj string
propNames Array.<string> <optional>
Source:
See:
Returns:
Type
conbo

(static) makeBindable(obj, propNamesopt) → {conbo}

Makes the specified properties of an object bindable; if no property names are passed, all variables will be made bindable
Parameters:
Name Type Attributes Description
obj Object
propNames Array.<string> <optional>
Source:
See:
Returns:
Type
conbo

(static) map(obj, iterator, scopeopt) → {Array}

Return the results of applying the iterator to each element. Delegates to native `map` if available.
Parameters:
Name Type Attributes Description
obj Object The list to iterate
iterator function Iterator function with parameters: item, index, list
scope Object <optional>
The scope the iterator function should run in
Deprecated:
  • Use Array.prototype.map
Source:
Returns:
Type
Array

(static) matches(attrs) → {function}

Returns a predicate for checking whether an object has a given set of `key:value` pairs.
Parameters:
Name Type Description
attrs Object Object containing key:value pairs to compare
Source:
Returns:
Type
function

(static) max(obj, iteratoropt, scopeopt) → {Object}

Return the maximum element or (element-based computation). Can't optimize arrays of integers longer than 65,535 elements.
Parameters:
Name Type Attributes Description
obj Object The list to iterate
iterator function <optional>
Function that tests each value
scope Object <optional>
The scope the iterator function should run in
Source:
See:
Returns:
Type
Object

(static) min(obj, iteratoropt, scopeopt) → {Object}

Return the minimum element (or element-based computation).
Parameters:
Name Type Attributes Description
obj Object The list to iterate
iterator function <optional>
Function that tests each value
scope Object <optional>
The scope the iterator function should run in
Source:
Returns:
Type
Object

(static) noop() → {function}

A function that does nothing
Source:
Returns:
Type
function

(static) notImplemented() → {function}

Default function to assign to the methods of pseudo-interfaces
Source:
Returns:
Type
function
Example
IExample = { myMethod:conbo.notImplemented };

(static) object(list, values) → {Array}

Converts lists into objects. Pass either a single array of `[key, value]` pairs, or two parallel arrays of the same length -- one of keys, and one of the corresponding values.
Parameters:
Name Type Description
list Object List of keys
values Object List of values
Source:
Returns:
Type
Array

(static) observeDom(namespace, rootElopt)

Watch the DOM for new Applications using the specified namespace By default, Conbo watches the entire DOM, but you can limit the scope by specifying a root element
Parameters:
Name Type Attributes Description
namespace conbo.Namespace
rootEl Element <optional>
Top most element to observe
Source:

(static) omit(obj, …propNames) → {Object}

Return an object containing all of the values from the source except the specified blacklisted properties.
Parameters:
Name Type Attributes Description
obj Object Object to copy
propNames string <repeatable>
Names of properties to omit
Source:
Returns:
Type
Object

(static) once(func) → {function}

Returns a function that will be executed at most one time, no matter how often you call it. Useful for lazy initialization.
Parameters:
Name Type Description
func function Function to call
Source:
Returns:
Type
function

(static) padLeft(value, minLengthopt, padChar=opt) → {string}

Pads a string with the specified character to the specified length
Parameters:
Name Type Attributes Default Description
value number | string String to pad
minLength number <optional>
2 Minimum length of the padded string
padChar= number | string <optional>
The character to use to pad the string
Source:
Returns:
Type
string

(static) parseTemplate(template, data) → {string}

Parse a template
Parameters:
Name Type Description
template string A string containing property names in {{moustache}} or ${ES2015} format to be replaced with property values
data Object An object containing the data to be used to populate the template
Source:
Returns:
The populated template
Type
string

(static) partial(func, …args) → {function}

Partially apply a function by creating a version that has had some of its arguments pre-filled, without changing its dynamic `this` scope.
Parameters:
Name Type Attributes Description
func function Method to partially pre-fill
args * <repeatable>
Arguments to pass to specified method
Source:
Returns:
Type
function

(static) partition(array, predicate) → {Array}

Split an array into two arrays: one whose elements all satisfy the given predicate, and one whose elements all do not satisfy the predicate.
Parameters:
Name Type Description
array Array The array to split
predicate function Function to determine a match, returning true or false
Source:
Returns:
Type
Array

(static) pick(obj, …propName) → {Object}

Return an object containing the values of each of whitelisted properties.
Parameters:
Name Type Attributes Description
obj Object Objects to copy properties from
propName string <repeatable>
Property names to copy
Source:
Returns:
Type
Object

(static) pluck(obj, key) → {Array}

Convenience version of a common use case of `map`: fetching a property.
Parameters:
Name Type Description
obj Object Array of Objects
key string Property name
Source:
Returns:
Type
Array

(static) property(key) → {function}

Get the property value
Parameters:
Name Type Description
key string Property name
Source:
Returns:
Type
function

(static) random(min, max) → {number}

Return a random integer between min and max (inclusive).
Parameters:
Name Type Description
min number Minimum number
max number Maximum number
Source:
Returns:
Type
number

(static) range(start, stop, stop) → {Array}

Generate an integer Array containing an arithmetic progression. A port of the native Python `range()` function.
Parameters:
Name Type Description
start number Start
stop number Stop
stop number Step
Source:
See:
Returns:
Type
Array

(static) ready(func, scopeopt) → {conbo}

Calls the specified function as soon as the DOM is ready, if it is not already, otherwise call it at the end of the current callstack
Parameters:
Name Type Attributes Description
func function The function to call
scope Object <optional>
The scope in which to run the specified function
Source:
Returns:
Type
conbo

(static) reject(obj, predicate, scopeopt) → {Array}

Return all the elements for which a truth test fails.
Parameters:
Name Type Attributes Description
obj Object The list to iterate
predicate function Function that tests each value, returning true or false
scope Object <optional>
The scope the predicate function should run in
Source:
Returns:
Type
Array

(static) rest(array, n, guardopt) → {Array}

Returns everything but the first entry of the array. Aliased as `tail` and `drop`. Especially useful on the arguments object. Passing an n will return the rest N values in the array. The guard check allows it to work with `conbo.map`.
Parameters:
Name Type Attributes Description
array Array The array to slice
n function The number of elements to return (default: 1)
guard Object <optional>
Optional
Source:
Returns:
Type
Array

(static) setDefaults(obj, …source) → {Object}

Fill in missing values on an object by setting the property values on the target object, without affecting the target's property descriptors
Parameters:
Name Type Attributes Description
obj Object Object to populate
source Object <repeatable>
Objects containging default values
Source:
Returns:
Type
Object

(static) shuffle(obj) → {Array}

Shuffle an array, using the modern version of the Fisher-Yates shuffle
Parameters:
Name Type Description
obj Object The list to shuffle
Source:
See:
Returns:
Type
Array

(static) size(obj) → {number}

Return the number of elements in an object.
Parameters:
Name Type Description
obj Object The object to count the keys of
Source:
Returns:
Type
number

(static) some(obj, predicate, scopeopt) → {Array}

Determine if at least one element in the object matches a truth test. Delegates to native `some` if available.
Parameters:
Name Type Attributes Description
obj Object The list to iterate
predicate function Function that tests each value, returning true or false
scope Object <optional>
The scope the predicate function should run in
Deprecated:
  • Use Array.prototype.some
Source:
Returns:
Type
Array

(static) sortOn(array, fieldName, optionsopt) → {Array}

Sorts the items in an array according to one or more fields in the array. The array should have the following characteristics:
  • The array is an indexed array, not an associative array.
  • Each element of the array holds an object with one or more properties.
  • All of the objects have at least one property in common, the values of which can be used to sort the array. Such a property is called a field.
Parameters:
Name Type Attributes Description
array Array The Array to sort
fieldName string The field/property name to sort on
options Object <optional>
Optional sort criteria: `descending` (Boolean), `caseInsensitive` (Boolean)
Source:
Returns:
Type
Array

(static) sum(obj) → {Number}

Returns the sum of all of the values in an array
Parameters:
Name Type Description
obj *
Source:
Returns:
Type
Number

(static) toArray(obj) → {Array}

Convert anything iterable into an Array
Parameters:
Name Type Description
obj Object The object to convert into an Array
Source:
Returns:
Type
Array

(static) toCamelCase(string, initCapopt) → {string}

Convert dash-or_underscore separated words into camelCaseWords
Parameters:
Name Type Attributes Default Description
string string underscore_case_string to convertToCamelCase
initCap boolean <optional>
false Should the first letter be a CapitalLetter? (default: false)
Source:
Returns:
Type
string

(static) toKebabCase(string) → {string}

Convert camelCaseWords into kebab-case-words
Parameters:
Name Type Description
string string camelCase string to convert to underscore_case
Source:
Returns:
Type
string

(static) toQueryString(obj) → {string}

Serialise an Object as a query string suitable for appending to a URL as GET parameters, e.g. foo=1&bar=2
Parameters:
Name Type Description
obj Object The Object to encode
Source:
Returns:
The URL encoded string
Type
string

(static) toString() → {string}

A string containing the framework name and version number, e.g. "ConboJS v1.2.3"
Source:
Returns:
Type
string

(static) toUnderscoreCase(string, separatoropt) → {string}

Convert camelCaseWords into underscore_case_words (or another user defined separator)
Parameters:
Name Type Attributes Default Description
string string camelCase string to convert to underscore_case
separator string <optional>
_ Default: "_"
Source:
Returns:
Type
string

(static) toValueString(value) → {string}

Converts a value into a string that can be used as the value of an HTML element
Parameters:
Name Type Description
value * The value to convert to a string
Source:
Returns:
Type
string

(static) union(…array) → {Array}

Produce an array that contains the union: each distinct element from all of the passed-in arrays.
Parameters:
Name Type Attributes Description
array array <repeatable>
Arrays to merge
Source:
Returns:
Type
Array

(static) uniq(array, isSorted, iterator, scopeopt) → {Array}

Produce a duplicate-free version of the array. If the array has already been sorted, you have the option of using a faster algorithm.
Parameters:
Name Type Attributes Description
array Array The array to filter
isSorted boolean Should the returned array be sorted?
iterator Object Iterator function
scope Object <optional>
The scope the iterator function should run in
Source:
Returns:
Type
Array

(static) uniqueId(prefixopt) → {string}

Generate a unique integer id (unique within the entire client session). Useful for temporary DOM ids.
Parameters:
Name Type Attributes Description
prefix string <optional>
String to prefix unique ID with
Source:
Returns:
Type
string

(static) unobserveDom(namespace, rootElopt)

Stop watching the DOM for new Applications
Parameters:
Name Type Attributes Description
namespace conbo.Namespace
rootEl Element <optional>
Top most element to observe
Source:

(static) values(obj, deepopt) → {Array}

Retrieve the values of an object's enumerable properties, optionally including values further up the prototype chain
Parameters:
Name Type Attributes Description
obj Object Object to get values from
deep boolean <optional>
Retrieve keys from further up the prototype chain?
Source:
Returns:
Type
Array

(static) variables(obj, deepopt) → {Array}

Extends Object.keys to retrieve the names of an object's enumerable variables
Parameters:
Name Type Attributes Description
obj Object Object to get keys from
deep boolean <optional>
Retrieve keys from further up the prototype chain?
Source:
See:
Returns:
Type
Array

(static) Viewable(namespaceopt, nameopt) → {function}

TypeScript / ES2017 decorator for adding Application, View and Glimpse classes a ConboJS namespace to enable auto instantiation
Parameters:
Name Type Attributes Description
namespace string <optional>
The name of the target namespace
name string <optional>
The name to use for this object in the target namespace (required if you use or compile to ES5 and minify your code)
Source:
Returns:
Decorator function
Type
function

(static) warn(…values) → {void}

Add a warning message to the console
Parameters:
Name Type Attributes Description
values * <repeatable>
Values to display in the console
Source:
Returns:
Type
void

(static) without(array, …Items) → {Array}

Return a version of the array that does not contain the specified value(s).
Parameters:
Name Type Attributes Description
array Array The array to remove the specified values from
Items * <repeatable>
to remove from the array
Source:
Returns:
Type
Array

(static) wrap(func, wrapper) → {function}

Returns the first function passed as an argument to the second, allowing you to adjust arguments, run code before and after, and conditionally execute the original function.
Parameters:
Name Type Description
func function Function to wrap
wrapper function Function to call
Source:
Returns:
Type
function