Skip to content

Commit

Permalink
[added] initialValue to TogglableProperty
Browse files Browse the repository at this point in the history
Reviewers: O3 Material JavaScript platform reviewers, #material_motion, O2 Material Motion, featherless

Reviewed By: #material_motion, O2 Material Motion, featherless

Tags: #material_motion

Differential Revision: http://codereview.cc/D2503
  • Loading branch information
appsforartists committed Jan 14, 2017
1 parent e8c985b commit 626b693
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/experimental-addons/src/TogglableProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ export class TogglableProperty<T> implements PropertyObservable<T> {
_onValue: T;
_offValue: T;

constructor({ onValue, offValue }: { onValue: T, offValue: T } = { onValue: true, offValue: false }) {
constructor({ onValue, offValue, initialValue }: { onValue: T, offValue: T, initialValue?: T } = { onValue: true, offValue: false }) {
this._onValue = onValue;
this._offValue = offValue;

if (initialValue === undefined) {
initialValue = this._offValue;
}

this._property.write(initialValue);
}

turnOn = (): void => {
Expand Down

0 comments on commit 626b693

Please sign in to comment.