Home Reference Source Repository
import IsolatedProperty from 'f.lux/src/IsolatedProperty.js'
public class | source

IsolatedProperty

Extends:

Property → IsolatedProperty

Static Method Summary

Static Public Methods
public static

createClass(shadowType: Object | IsolatedShadow, typeCallback: function(type: StateType), initialState: Object): MapProperty

Factory function for creating an MapProperty subclass suitable for using with new.

public static

defineType(PropClass: MapProperty, ShadowType: Object | MapShadow, typeCallback: function(type: StateType), initialState: Object)

Factory function for setting up the StateType type class variable with an appropriately configured intial state.

Constructor Summary

Public Constructor
public

constructor(stateType: StateType)

If a StateType is not passed to this constructor then one is located using StateType.from thus ensuring the f.lux shadowing process is defined for this property.

Member Summary

Public Members
public

[_id]: *

public

[_key]: *

public

Method Summary

Public Methods
public

create$(impl: *): Access

Creates the object to be assigned to the shadow.$ property.

public

An isolated property returns owner's dotPath() value.

public

An isolated property returns owner's isActive() value.

public

Gets if property is an actual isolated property managed by the store.

public

An isolated property returns owner's isReadonly() value.

public

An isolated property is never a root.

public

Gets the ID used by the store to track this isolated property.

public

key(): *

public

Gets the property managing this isolated object.

public

parent(): []

An isolated property returns owner property for the parent.

public

propertyChildInvalidated(childProperty: *, sourceProperty: *)

public
public

setKey(key: *)

public

setOwner(owner: Property)

Sets the property that owns/contains this isolated property.

Inherited Summary

From class Property
public
public
public
public

[_checkpoint]: {"data": *}

public

[_impl]: *

public
public

[_mixins]: *[]

public
public

[_pid]: *

public
public
public
public
public

Use this.$$() in shadow methods to get access to the property.

public

Gets if autoshadowing is enabled for this property.

public

Copies the current actual state for later reset using Property#resetToCheckpoint.

public

Clears an existing checkpoint created using Property#checkpoint.

public

create$(impl: *): Access

Creates the object to be assigned to the shadow.$ property.

public

Gets the path from root property using a dot (.) separator.

public

Gets the checkpoint state previously recorded using Property#checkpoint.

public

getInitialState(state: *): *

Gets the initial state for a property at the beginning of the property mounting process.

public

Gets if an existing checkpoint has be created using Property#checkpoint.

public

Gets the result from StateType#computeInitialState.

public

Gets if the property is currently shadowing an actual state property.

public

Gets if property is an actual isolated property managed by the store.

public

Gets if the property allows for assignment through the shadow state, ie todo.desc = "go skiing".

public

Gets if this is the shadow state root property.

public

The property name by which this property is referenced by the Property.parent.

public

nextState(): *

Gets what the actual state for this property will be after the Store updates all pending actions.

public

Gets the object containing or managing this property.

public

Gets the parent property.

public

Gets the parent's shadow property.

public

path(): []

Gets the Property#name components from the root property to this property.

public

pid(): number

Gets the unique f.lux ID for this property.

public

propertyChildInvalidated(childProperty: Property, sourceProperty: Property)

A child property or one of its descendents wil be changing state.

public

Invoked by the f.lux shadowing process after a property initially shadows a state property.

public

Invoked by the f.lux shadowing process after a property is reshadowed.

public

Invoked by the f.lux shadowing process just before a property initially shadows a state property.

public

Invoked by the f.lux shadowing process just before a property will be removed from the shadow state.

public

Replaces the current property state with a checkpoint state previously recorded using Property#checkpoint.

public

Gets the shadow state root property for the Store managing this property.

public

Gets the root shadow state for the Store managing this property.

public

Sets the auto shadow property flag.

public

setImplementationClass(ImplClass: *)

public

Explicitly sets an initial state that will be used if the state tree does not have a value for this property.

public

setReadonly(readonly: *)

Sets the readonly flag which will prevent an assignment from changing the value.

public

setShadowClass(ShadowClass: Shadow)

Sets the class to be used for the shadow api

public

shader(state: *): *

Gets the Shader instance for this property.

public

Returns the Shadow subclass used to virtualize the state property.

public

Gets the path from root property using a slash (/) separator.

public

state(): *

Gets the actual state being shadowed.

public

stateType(): *

Gets the StateType used for creating this property.

public

store(): *

Gets the {@Link Store} containing the application state.

public

touch()

Triggers a reshadow of the properties shadow state.

public

typeName(): *

Gets this property's StateType.typeName value.

public

update(callback: function)

Makes changes to the next proeprty state.

Static Public Methods

public static createClass(shadowType: Object | IsolatedShadow, typeCallback: function(type: StateType), initialState: Object): MapProperty source

Factory function for creating an MapProperty subclass suitable for using with new. The generated class will have the type StateType descriptor set upon return.

Example usage:

class SomeShadow extends MapShadow {
// definition here
}

export default MapProperty.createClass(SomeShadow, type => {
// configure type variable
});

Params:

NameTypeAttributeDescription
shadowType Object | IsolatedShadow
  • optional
  • default: {}

MapShadow subclass or object literal api definition. If object literal specified, each property and function is mapped onto a Shadow subclass.

typeCallback function(type: StateType)
  • optional

a callback function that will be passed the StateType spec for additional customization, such as setting autoshadow, initial state, or readonly.

initialState Object
  • optional
  • default: {}

the initial state for the new property.

Return:

MapProperty

newly defined MapProperty subclass.

public static defineType(PropClass: MapProperty, ShadowType: Object | MapShadow, typeCallback: function(type: StateType), initialState: Object) source

Factory function for setting up the StateType type class variable with an appropriately configured intial state.

Example usage:

export default class SomeProperty extends MapProperty {
// implement property here
}

class SomeShadow extends MapShadow {
// implement shadow api here
}

IsolatedProperty.defineType(SomeProperty, SomeShadow, type => {
// configure type variable
});

Params:

NameTypeAttributeDescription
PropClass MapProperty

MapProperty subclass

ShadowType Object | MapShadow
  • optional

MapShadow subclass or object literal api definition. If object literal specified, each property and function is mapped onto a Shadow subclass.

typeCallback function(type: StateType)
  • optional

a callback function that will be passed the StateType spec for additional customization, such as setting autoshadow, initial state, or readonly.

initialState Object
  • optional
  • default: {}

the initial state for the new property.

Public Constructors

public constructor(stateType: StateType) source

If a StateType is not passed to this constructor then one is located using StateType.from thus ensuring the f.lux shadowing process is defined for this property.

Override:

Property#constructor

Params:

NameTypeAttributeDescription
stateType StateType
  • optional

a specialized StateType instance describing how f.lux should shadow this property.

Public Members

public [_id]: * source

public [_key]: * source

public [_owner]: * source

Public Methods

public create$(impl: *): Access source

Creates the object to be assigned to the shadow.$ property. Subclasses can override this method to setup a chain of specialized accessors ($()). See Access for details on setting up specialized accessors. This is an advanced feature and rarely required.

Override:

Property#create$

Params:

NameTypeAttributeDescription
impl *

Return:

Access

a property accessor instance.

public dotPath(): string source

An isolated property returns owner's dotPath() value.

Override:

Property#dotPath

Return:

string

path with each component joined by a .

See:

public isActive(): boolean source

An isolated property returns owner's isActive() value.

Override:

Property#isActive

Return:

boolean

public isIsolated(): boolean source

Gets if property is an actual isolated property managed by the store.

Override:

Property#isIsolated

Return:

boolean

public isReadonly(): boolean source

An isolated property returns owner's isReadonly() value.

Override:

Property#isReadonly

Return:

boolean

public isRoot(): boolean source

An isolated property is never a root.

Override:

Property#isRoot

Return:

boolean

false

public isolationId(): string source

Gets the ID used by the store to track this isolated property.

Return:

string

public key(): * source

Return:

*

public owner(): Property source

Gets the property managing this isolated object.

Override:

Property#owner

Return:

Property

public parent(): [] source

An isolated property returns owner property for the parent.

Override:

Property#parent

Return:

[]

public propertyChildInvalidated(childProperty: *, sourceProperty: *) source

A child property or one of its descendents wil be changing state. Useful hook when a property needs to perform some bookkeepng for child properties. Utilizing this hook provides a chance to make tracking changes in shadow properties before the store updates its state.

Subclasses do not need to invoke the parent implementation.

Override:

Property#propertyChildInvalidated

Params:

NameTypeAttributeDescription
childProperty *
sourceProperty *

public propertyWillUnshadow() source

Invoked by the f.lux shadowing process just before a property will be removed from the shadow state.

Subclasses do not need to invoke the parent implementation.

Override:

Property#propertyWillUnshadow

public setKey(key: *) source

Params:

NameTypeAttributeDescription
key *

public setOwner(owner: Property) source

Sets the property that owns/contains this isolated property.

Params:

NameTypeAttributeDescription
owner Property

the object containing/managing this isolated property.