Class: ChangeCounter

ChangeCounter(target)

new ChangeCounter(target)

A ChangeCounter keeps a target object whose change count is tracked by a local change count. You can set to a new target which updates the local change count, and you can call checkChanged to check if the target (or one of the target's targets) has been changed. The target object must have a method getChangeCount. Create a new ChangeCounter to track the given target. If target is not null, this sets the local change counter to target.getChangeCount().
Parameters:
Name Type Description
target object The target to track, as an object with the method getChangeCount().
Source:

Methods

checkChanged() → {boolean}

If the target's change count is different than the local change count, then update the local change count and return true. Otherwise return false, meaning that the target has not changed. Also, if the target is null, simply return false. This is useful since the target (or one of the target's targets) may be changed and you need to find out.
Source:
Returns:
True if the change count has been updated, false if not.
Type
boolean

get() → {object}

Get the target object. If the target is changed, then checkChanged will detect it.
Source:
Returns:
The target, as an object with the method getChangeCount().
Type
object

set(target)

Set the target to the given target. If target is not null, this sets the local change counter to target.getChangeCount().
Parameters:
Name Type Description
target object The target to track, as an object with the method getChangeCount().
Source: