Skip to content

Commit

Permalink
made stuff private
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Feb 9, 2016
1 parent 5cc02a9 commit 701f32e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/core/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ export class Atom implements IAtom {
/**
* Invoke this method to notify mobservable that your atom has been used somehow.
*/
reportObserved() {
public reportObserved() {
reportObserved(this);
}

/**
* Invoke this method _after_ this method has changed to signal mobservable that all its observers should invalidate.
*/
reportChanged() {
public reportChanged() {
if (!this.isDirty) {
this.reportStale();
this.reportReady(true);
Expand Down
8 changes: 4 additions & 4 deletions src/core/computedvalue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ComputedValue<T> implements IObservable, IDerivation {
* Peek into the current value of this computedObservable. Re-evaluate if needed but don't bind the current
* exeuction context as an observer.
*/
peek: () => T;
public peek: () => T;

/**
* Create a new computed value based on a function expression.
Expand Down Expand Up @@ -79,7 +79,7 @@ export class ComputedValue<T> implements IObservable, IDerivation {
* Returns the current value of this computed value.
* Will evaluate it's computation first if needed.
*/
get(): T {
public get(): T {
if (this.isComputing)
throw new Error(`[DerivedValue '${this.name}'] Cycle detected`);
if (this.dependencyStaleCount > 0 && globalState.inTransaction > 0) {
Expand All @@ -105,11 +105,11 @@ export class ComputedValue<T> implements IObservable, IDerivation {
return this.value;
}

set(_: T) {
public set(_: T) {
throw new Error(`[DerivedValue '${name}'] View functions do not accept new values`);
}

trackAndCompute(): boolean {
private trackAndCompute(): boolean {
let oldValue = this.value;
this.value = trackDerivedFunction(this, this.peek);
return valueDidChange(this.compareStructural, this.value, oldValue);
Expand Down
4 changes: 2 additions & 2 deletions src/types/observablemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ObservableMap<V> {
initialData.forEach(([key, value]) => this.set(key, value));
}

_has(key: string): boolean {
private _has(key: string): boolean {
return typeof this._data[key] !== "undefined";
}

Expand Down Expand Up @@ -90,7 +90,7 @@ export class ObservableMap<V> {
}
}

_updateHasMapEntry(key: string, value: boolean): ObservableValue<boolean> {
private _updateHasMapEntry(key: string, value: boolean): ObservableValue<boolean> {
// optimization; don't fill the hasMap if we are not observing, or remove entry if there are no observers anymore
let entry = this._hasMap[key];
if (entry) {
Expand Down
1 change: 1 addition & 0 deletions src/types/observableobject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class ObservableObject {
value: this
});
}

static asReactive(target, name: string, mode: ValueMode):ObservableObject {
if (target.$mobservable)
return target.$mobservable;
Expand Down
3 changes: 1 addition & 2 deletions src/utils/simpleeventemitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {once, Lambda} from "./utils";
export class SimpleEventEmitter {
listeners:{(...data: any[]): void}[] = [];

emit(...data: any[]);
emit() {
emit(...data: any[]) {
const listeners = this.listeners.slice();
for (let i = 0, l = listeners.length; i < l; i++)
listeners[i].apply(null, arguments);
Expand Down

0 comments on commit 701f32e

Please sign in to comment.