ComponentChangeTracker

ComponentChangeTrackers listen for evals of the componet module and then make sure the new master components replace the currently visible ones seamlessly so direct manipulation does not happen on abandoned master components any more. They also listen for changes on the component morphs in case they are open and reconcile the corresponding source code to reflect these changes.

Constructor

new ComponentChangeTracker()

Classes

ComponentChangeTracker

Members

componentPolicy :StylePolicy

Returns the policy that is wrapped by the component descriptor.

Type:
  • StylePolicy

currentModuleSource :string

The current source of the module object that manages the source code this component is defined in.

Type:
  • string

Methods

adjournChange(change) → {boolean}

Given a change, returns wether or not we can delay the reconciliation of that change to a later time. This can be beneficial, since we sometimes want to avoid degrading performance when properties that are expensive to reconcile are changed in quick succession.

Parameters:
NameTypeDescription
changeobject

The change to check.

Returns:
Type: 
boolean

equals(otherTracker, componentName) → {boolean}

Compares two trackers in order to check if they are equivalent.

Parameters:
NameTypeDescription
otherTrackerComponentChangeTracker
componentNamestring

Name of the component to track.

Returns:
Type: 
boolean

ignoreChange(change) → {boolean}

Filter function that allows us to check if we need to reconcile a particular change or not. ChangeTrackers work on a whitelisting policy. That is, for a change to even be considered, it needs have set the meta property reconcileChanges to true.

Parameters:
NameTypeDescription
changeobject

The change object to check

Returns:
Type: 
boolean

isPositionedByLayout(aMorph) → {boolean}

Checks if a given morph's position is dictacted by a layout. In those cases reconciling position changes can be skipped.

Parameters:
NameTypeDescription
aMorphMorph

The morph to check for.

Returns:
Type: 
boolean

onceChangesProcessed() → {Promise.<boolean>}

. When processing changes have to wait for the module system, since the writing of files to the file system is asynchronous. This method returns a promise that will resolve once all the changes that are being processed by the tracker have been effective.

Returns:
Type: 
Promise.<boolean>

(async) processChangeInComponent(change)

Called in response to changes in the component morph in order to reconcile these changes in the source code as well as the currently initialized policy object.

Parameters:
NameTypeDescription
changeobject

The change to reconcile.

whenReady() → {Promise.<boolean>}

Returns a promise that once resolves denotes that the tracker is ready to reconcile changes with the module.

Returns:
Type: 
Promise.<boolean>