Socket
Socket
Sign inDemoInstall

mobservable

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobservable - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

95

dist/mobservable.js

@@ -0,1 +1,2 @@

/// <reference path="./typings/node-0.10.d.ts" />
var __extends = this.__extends || function (d, b) {

@@ -22,5 +23,3 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];

propFunc.prop = prop;
propFunc.toString = function () {
return prop.toString();
};
propFunc.toString = function () { return prop.toString(); };
return propFunc;

@@ -290,8 +289,4 @@ }

};
ObservableArray.prototype.toString = function () {
return this.wrapReadFunction("toString", arguments);
};
ObservableArray.prototype.toLocaleString = function () {
return this.wrapReadFunction("toLocaleString", arguments);
};
ObservableArray.prototype.toString = function () { return this.wrapReadFunction("toString", arguments); };
ObservableArray.prototype.toLocaleString = function () { return this.wrapReadFunction("toLocaleString", arguments); };
ObservableArray.prototype.concat = function () {

@@ -304,41 +299,15 @@ var items = [];

};
ObservableArray.prototype.join = function (separator) {
return this.wrapReadFunction("join", arguments);
};
ObservableArray.prototype.reverse = function () {
return this.wrapReadFunction("reverse", arguments);
};
ObservableArray.prototype.slice = function (start, end) {
return this.wrapReadFunction("slice", arguments);
};
ObservableArray.prototype.sort = function (compareFn) {
return this.wrapReadFunction("sort", arguments);
};
ObservableArray.prototype.indexOf = function (searchElement, fromIndex) {
return this.wrapReadFunction("indexOf", arguments);
};
ObservableArray.prototype.lastIndexOf = function (searchElement, fromIndex) {
return this.wrapReadFunction("lastIndexOf", arguments);
};
ObservableArray.prototype.every = function (callbackfn, thisArg) {
return this.wrapReadFunction("every", arguments);
};
ObservableArray.prototype.some = function (callbackfn, thisArg) {
return this.wrapReadFunction("some", arguments);
};
ObservableArray.prototype.forEach = function (callbackfn, thisArg) {
return this.wrapReadFunction("forEach", arguments);
};
ObservableArray.prototype.map = function (callbackfn, thisArg) {
return this.wrapReadFunction("map", arguments);
};
ObservableArray.prototype.filter = function (callbackfn, thisArg) {
return this.wrapReadFunction("filter", arguments);
};
ObservableArray.prototype.reduce = function (callbackfn, initialValue) {
return this.wrapReadFunction("reduce", arguments);
};
ObservableArray.prototype.reduceRight = function (callbackfn, initialValue) {
return this.wrapReadFunction("reduceRight", arguments);
};
ObservableArray.prototype.join = function (separator) { return this.wrapReadFunction("join", arguments); };
ObservableArray.prototype.reverse = function () { return this.wrapReadFunction("reverse", arguments); };
ObservableArray.prototype.slice = function (start, end) { return this.wrapReadFunction("slice", arguments); };
ObservableArray.prototype.sort = function (compareFn) { return this.wrapReadFunction("sort", arguments); };
ObservableArray.prototype.indexOf = function (searchElement, fromIndex) { return this.wrapReadFunction("indexOf", arguments); };
ObservableArray.prototype.lastIndexOf = function (searchElement, fromIndex) { return this.wrapReadFunction("lastIndexOf", arguments); };
ObservableArray.prototype.every = function (callbackfn, thisArg) { return this.wrapReadFunction("every", arguments); };
ObservableArray.prototype.some = function (callbackfn, thisArg) { return this.wrapReadFunction("some", arguments); };
ObservableArray.prototype.forEach = function (callbackfn, thisArg) { return this.wrapReadFunction("forEach", arguments); };
ObservableArray.prototype.map = function (callbackfn, thisArg) { return this.wrapReadFunction("map", arguments); };
ObservableArray.prototype.filter = function (callbackfn, thisArg) { return this.wrapReadFunction("filter", arguments); };
ObservableArray.prototype.reduce = function (callbackfn, initialValue) { return this.wrapReadFunction("reduce", arguments); };
ObservableArray.prototype.reduceRight = function (callbackfn, initialValue) { return this.wrapReadFunction("reduceRight", arguments); };
ObservableArray.prototype.wrapReadFunction = function (funcName, args) {

@@ -363,3 +332,3 @@ var baseFunc = Array.prototype[funcName];

function DNode() {
this.state = 2 /* READY */;
this.state = DNodeState.READY;
this.observing = [];

@@ -391,13 +360,13 @@ this.prevObserving = [];

DNode.prototype.markStale = function () {
if (this.state === 1 /* PENDING */)
if (this.state === DNodeState.PENDING)
return;
if (this.state === 0 /* STALE */)
if (this.state === DNodeState.STALE)
return;
this.state = 0 /* STALE */;
this.state = DNodeState.STALE;
this.notifyObservers();
};
DNode.prototype.markReady = function (didTheValueActuallyChange) {
if (this.state === 2 /* READY */)
if (this.state === DNodeState.READY)
return;
this.state = 2 /* READY */;
this.state = DNodeState.READY;
this.notifyObservers(didTheValueActuallyChange);

@@ -415,3 +384,3 @@ Scheduler.scheduleReady();

for (var i = 0; i < l; i++)
if (obs[i].state !== 2 /* READY */)
if (obs[i].state !== DNodeState.READY)
return false;

@@ -423,8 +392,8 @@ return true;

switch (this.state) {
case 0 /* STALE */:
if (observable.state === 2 /* READY */ && didTheValueActuallyChange)
case DNodeState.STALE:
if (observable.state === DNodeState.READY && didTheValueActuallyChange)
this.dependencyChangeCount += 1;
if (observable.state === 2 /* READY */ && this.areAllDependenciesAreStable()) {
if (observable.state === DNodeState.READY && this.areAllDependenciesAreStable()) {
if (this.dependencyChangeCount > 0) {
this.state = 1 /* PENDING */;
this.state = DNodeState.PENDING;
Scheduler.schedule(function () { return _this.computeNextValue(); });

@@ -438,6 +407,6 @@ }

break;
case 1 /* PENDING */:
case DNodeState.PENDING:
break;
case 2 /* READY */:
if (observable.state === 0 /* STALE */)
case DNodeState.READY:
if (observable.state === DNodeState.STALE)
this.markStale();

@@ -473,3 +442,3 @@ break;

DNode.prototype.notifyObserved = function () {
if (this.state === 1 /* PENDING */)
if (this.state === DNodeState.PENDING)
throw new Error("Cycle detected");

@@ -476,0 +445,0 @@ var ts = DNode.trackingStack, l = ts.length;

@@ -1,35 +0,35 @@

declare module "mobservable" {
interface Lambda {
(): void;
}
interface IObservableValue<T, S> {
(): T;
(value: T): S;
subscribe(callback: (newValue: T, oldValue: T) => void): Lambda;
}
interface Lambda {
(): void;
}
interface IObservableValue<T, S> {
(): T;
(value: T): S;
subscribe(callback: (newValue: T, oldValue: T) => void): Lambda;
}
interface MobservableStatic {
<T,S>(value?:T|{():T}, scope?:S):IObservableValue<T,S>;
interface MobservableStatic {
<T,S>(value?:T|{():T}, scope?:S):IObservableValue<T,S>;
value<T,S>(value?:T|{():T}, scope?:S):IObservableValue<T,S>;
watch<T>(func:()=>T, onInvalidate:Lambda):[T,Lambda];
array<T>(values?:T[]): IObservableArray<T>;
batch(action:Lambda);
onReady(listener:Lambda):Lambda;
onceReady(listener:Lambda);
defineProperty<T>(object:Object, name:string, initialValue?:T);
}
value<T,S>(value?:T|{():T}, scope?:S):IObservableValue<T,S>;
watch<T>(func:()=>T, onInvalidate:Lambda):[T,Lambda];
array<T>(values?:T[]): IObservableArray<T>;
batch(action:Lambda);
onReady(listener:Lambda):Lambda;
onceReady(listener:Lambda);
defineProperty<T>(object:Object, name:string, initialValue?:T);
}
interface IObservableArray<T> extends Array<T> {
[n: number]: T;
length: number;
interface IObservableArray<T> extends Array<T> {
[n: number]: T;
length: number;
spliceWithArray(index:number, deleteCount?:number, newItems?:T[]):T[];
observe(listener:()=>void, fireImmediately:boolean):Lambda;
clear(): T[];
replace(newItems:T[]);
values(): T[];
}
spliceWithArray(index:number, deleteCount?:number, newItems?:T[]):T[];
observe(listener:()=>void, fireImmediately:boolean):Lambda;
clear(): T[];
replace(newItems:T[]);
values(): T[];
}
declare module "mobservable" {
export = MobservableStatic;
}
}
{
"name": "mobservable",
"version": "0.1.0",
"version": "0.1.1",
"description": "Changes are coming! Small library for creating observable properties en functions",

@@ -5,0 +5,0 @@ "main": "dist/mobservable.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc