Skip to content

Commit

Permalink
Fixing set() by passing batch on recursive call, removing onset()
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Feb 4, 2017
1 parent 213d643 commit c436884
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Event listener for transforming an API response, receives `body`, `status` & `he
**onset**
_Function_
Event listener for when a record is set, receives an `Array`, `Boolean` for batch operation, & `Boolean` for reversion.
Event listener for when a record is set, receives an `Array`.
**onsync**
_Function_
Expand Down
8 changes: 3 additions & 5 deletions lib/haro.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Jason Mulligan <jason.mulligan@avoidwork.com>
* @copyright 2017
* @license BSD-3-Clause
* @version 3.1.12
* @version 3.1.13
*/
"use strict";

Expand Down Expand Up @@ -879,12 +879,10 @@
}

if (og) {
this.set(key, og, true, true).then(() => {
this.set(key, og, batch, true).then(() => {
if (this.logging) {
console.log("Reverted", key);
}

this.onset(this.list(key, og), batch, true);
}).catch(() => {
if (this.logging) {
console.log("Failed to revert", key);
Expand Down Expand Up @@ -1157,7 +1155,7 @@
}

factory.transform = cast;
factory.version = "3.1.12";
factory.version = "3.1.13";

// Node, AMD & window supported
if (typeof exports !== "undefined") {
Expand Down
8 changes: 3 additions & 5 deletions lib/haro.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Jason Mulligan <jason.mulligan@avoidwork.com>
* @copyright 2017
* @license BSD-3-Clause
* @version 3.1.12
* @version 3.1.13
*/
"use strict";

Expand Down Expand Up @@ -1074,12 +1074,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}

if (og) {
_this13.set(key, og, true, true).then(function () {
_this13.set(key, og, batch, true).then(function () {
if (_this13.logging) {
console.log("Reverted", key);
}

_this13.onset(_this13.list(key, og), batch, true);
}).catch(function () {
if (_this13.logging) {
console.log("Failed to revert", key);
Expand Down Expand Up @@ -1408,7 +1406,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}

factory.transform = cast;
factory.version = "3.1.12";
factory.version = "3.1.13";

// Node, AMD & window supported
if (typeof exports !== "undefined") {
Expand Down
2 changes: 1 addition & 1 deletion lib/haro.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/haro.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haro",
"version": "3.1.12",
"version": "3.1.13",
"description": "Harō is a modern immutable DataStore",
"main": "lib/haro.es6.js",
"scripts": {
Expand Down
4 changes: 1 addition & 3 deletions src/haro.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,10 @@
}

if (og) {
this.set(key, og, true, true).then(() => {
this.set(key, og, batch, true).then(() => {
if (this.logging) {
console.log("Reverted", key);
}

this.onset(this.list(key, og), batch, true);
}).catch(() => {
if (this.logging) {
console.log("Failed to revert", key);
Expand Down

0 comments on commit c436884

Please sign in to comment.