API Docs for:
Show:

flocks Class

The Flocks library module. Load this module and use either the flocks flocks.createClass wrapper or the flocks plumbing mixin to create flocks controls. Place them into your document using flocks.mount, and use the returned function or the data and method that the mixin provides, this.fctx and this.fset() respectively, to read and write to the flocks state.

And suddenly you're done.

Please see the tutorials for more information.

Methods

atLeastFlocks

()

atLeastFlocks accepts a mixin set from a control spec, or the value undefined, and produces a mixin set in response, which contains the old mixin set if any, pre-pended with the flocks plumbing mixin, or a mixin set with just that mixin if the previous mixin set was empty or undefined. If the mixin set provided already contains flocks, it will be returned unaltered, in case the prior mixin set is order sensitive.

This is not a method that the end user should expect to use.

clone

()

clone recursively deep-copies its argument.

createClass

()

createClass is a wrapper for react.createClass which automatically adds the plumbing mixin to your control's spec, to keep visual noise down. If you prefer, you can add the plumbing mixin manually, in the standard fashion, instead; that may be more convenient in situations where many mixins are in use, or where other wrappers of createClass are in use.

enforceArray

()

enforceArray accepts a value argument and an optional explanation argument, and will throw if the value argument is not of type Array. The throw will be the explanation argument, or a default if the explanation is not present.

enforceNonArrayObject

()

enforceNonArrayObject accepts a value argument and an optional explanation argument, and will throw if the value argument is of type Array, or not of type Object. The throw will be the explanation argument, or a default if the explanation is not present.

enforceString

()

enforceString accepts a value argument and an optional explanation argument, and will throw if the value argument is not of type string. The throw will be the explanation argument, or a default if the explanation is not present.

isArray

()

isArray produces a boolean regarding whether its argument is a javascript Array.

isNonArrayObject

()

isNonArrayObject produces a boolean regarding whether its argument is a javascript Object, but also goes to the effort to exclude javascript Arrays.

isStringOfNonNegInt

()

isStringOfNonNegInt will tell you whether a string contains a very strict interpretation of decimal non-negative integers: either the single character zero, or a sequence of digits not beginning with zero. As such this does not allow alternative radices, scientific notation, leading zeroes, empty mantissas, leading plusses, negative numbers in general, or other non-strict variants.

isUndefined

()

isUndefined produces a boolean regarding whether its argument is the javascript value undefined.

mount

()

mount accepts a flocks config and an initial state, and then manages a root control for you. mount returns to you a function which you can use from outside the control tree to update the flocks state. From inside the control tree, a control decorated with the flocks plumbing has a member

this.fctx which contains an up to date copy of the flocks state, and another member this.fset() which you can use to update the flocks state.

To mount a control is to start the process by placing your top level control into the document through flocks.

Properties

version

String
version is an exposed string on the module export which mentions the current library version. This number should always be in sync with the package.json and bower.json version, the github tag, the npm version, and will define the paths available on cdnjs