Skip to content

Commit f6ee2ab

Browse files
committed
Implemented local transports for tests and publishing 0.4.0
1 parent 5ed5644 commit f6ee2ab

File tree

14 files changed

+334
-281
lines changed

14 files changed

+334
-281
lines changed

dist/browser.js

Lines changed: 93 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* dop@0.3.2
2+
* dop@0.4.0
33
* www.distributedobjectprotocol.org
44
* © 2016 Josema Gonzalez
55
* MIT License.
@@ -20,7 +20,7 @@ var dop = {
2020
object:{},
2121
object_data:{},
2222
collectors:[[],[]],
23-
lastGet:{}
23+
// lastGet:{}
2424
},
2525

2626
// src
@@ -171,13 +171,13 @@ function websocket(dop, node, options) {
171171

172172
// Helpers
173173
function send(message) {
174-
(socket.readyState===socket.constructor.OPEN && readyState===CONNECT) ?
174+
(socket.readyState===OPEN && readyState===CONNECT) ?
175175
socket.send(message)
176176
:
177177
send_queue.push(message);
178178
}
179179
function sendQueue() {
180-
if (socket.readyState===socket.constructor.OPEN)
180+
if (socket.readyState===OPEN)
181181
while (send_queue.length>0)
182182
socket.send(send_queue.shift());
183183
}
@@ -891,93 +891,6 @@ dop.setAction = function(action) {
891891
};
892892

893893

894-
dop.core.setAction = function(destiny, prop, value, typeofValue, path) {
895-
896-
// if (path.length > 1) {
897-
898-
var typeofDestiny = dop.util.typeof(destiny[prop]);
899-
900-
// Array mutations
901-
if (typeofValue=='object' && value.hasOwnProperty(dop.cons.DOP)) {
902-
903-
var mutations = value[dop.cons.DOP],
904-
mutation,
905-
index=0,
906-
total=mutations.length;
907-
908-
if (typeofDestiny!='array')
909-
dop.set(destiny, prop, []);
910-
911-
for (;index<total; ++index) {
912-
mutation = mutations[index];
913-
// swaps
914-
if (mutation[0]<0 || mutation[1]<0) {
915-
mutation = mutation.slice(0);
916-
(mutation[0]<0) ? mutation[0] = mutation[0]*-1 : mutation[1] = mutation[1]*-1;
917-
dop.core.swap(destiny[prop], mutation);
918-
}
919-
// set
920-
else {
921-
if (destiny[prop].length<mutation[0])
922-
dop.getObjectTarget(destiny[prop]).length = mutation[0];
923-
// set
924-
if (mutation.length===3 && mutation[1]===1) {
925-
(mutation[2] === undefined) ?
926-
dop.del(destiny[prop], mutation[0])
927-
:
928-
dop.set(destiny[prop], mutation[0], mutation[2]);
929-
}
930-
// splice
931-
else
932-
dop.core.splice(destiny[prop], mutation);
933-
}
934-
}
935-
936-
if (typeof value.length == 'number' && value.length>-1)
937-
destiny[prop].length = value.length;
938-
939-
940-
return true; // Skiping to dont go inside of {~dop:...}
941-
}
942-
943-
else {
944-
945-
// Deeply
946-
if (typeofValue=='object' && !destiny.hasOwnProperty(prop))
947-
dop.set(destiny, prop, {});
948-
949-
// Delete
950-
else if (typeofValue=='undefined')
951-
dop.del(destiny, prop);
952-
953-
// Set array and skip path deep
954-
else if (typeofValue=='array') {
955-
dop.set(destiny, prop, dop.util.merge([], value));
956-
return true;
957-
}
958-
959-
// Set array and skip path deep
960-
else if (typeofValue=='object' && typeofDestiny!='object' && typeofDestiny!='array') {
961-
dop.set(destiny, prop, dop.util.merge({}, value));
962-
return true;
963-
}
964-
965-
// Set value
966-
else if (typeofValue!='object')
967-
dop.set(destiny, prop, value);
968-
969-
}
970-
// }
971-
};
972-
// dop.core.setActionLoop = function() {
973-
// if (prop === dop.cons.DOP)
974-
// return true;
975-
// };
976-
977-
978-
979-
980-
981894

982895

983896
////////// src/api/unobserve.js
@@ -2152,6 +2065,95 @@ dop.core.proxyObjectHandler = {
21522065

21532066

21542067

2068+
////////// src/core/objects/setAction.js
2069+
2070+
dop.core.setAction = function(destiny, prop, value, typeofValue, path) {
2071+
2072+
// if (path.length > 1) {
2073+
2074+
var typeofDestiny = dop.util.typeof(destiny[prop]);
2075+
2076+
// Array mutations
2077+
if (typeofValue=='object' && value.hasOwnProperty(dop.cons.DOP)) {
2078+
2079+
var mutations = value[dop.cons.DOP],
2080+
mutation,
2081+
index=0,
2082+
total=mutations.length;
2083+
2084+
if (typeofDestiny!='array')
2085+
dop.set(destiny, prop, []);
2086+
2087+
for (;index<total; ++index) {
2088+
mutation = mutations[index];
2089+
// swaps
2090+
if (mutation[0]<0 || mutation[1]<0) {
2091+
mutation = mutation.slice(0);
2092+
(mutation[0]<0) ? mutation[0] = mutation[0]*-1 : mutation[1] = mutation[1]*-1;
2093+
dop.core.swap(destiny[prop], mutation);
2094+
}
2095+
// set
2096+
else {
2097+
if (destiny[prop].length<mutation[0])
2098+
dop.getObjectTarget(destiny[prop]).length = mutation[0];
2099+
// set
2100+
if (mutation.length===3 && mutation[1]===1) {
2101+
(mutation[2] === undefined) ?
2102+
dop.del(destiny[prop], mutation[0])
2103+
:
2104+
dop.set(destiny[prop], mutation[0], mutation[2]);
2105+
}
2106+
// splice
2107+
else
2108+
dop.core.splice(destiny[prop], mutation);
2109+
}
2110+
}
2111+
2112+
if (typeof value.length == 'number' && value.length>-1)
2113+
destiny[prop].length = value.length;
2114+
2115+
2116+
return true; // Skiping to dont go inside of {~dop:...}
2117+
}
2118+
2119+
else {
2120+
2121+
// Deeply
2122+
if (typeofValue=='object' && !destiny.hasOwnProperty(prop))
2123+
dop.set(destiny, prop, {});
2124+
2125+
// Delete
2126+
else if (typeofValue=='undefined')
2127+
dop.del(destiny, prop);
2128+
2129+
// Set array and skip path deep
2130+
else if (typeofValue=='array') {
2131+
dop.set(destiny, prop, dop.util.merge([], value));
2132+
return true;
2133+
}
2134+
2135+
// Set array and skip path deep
2136+
else if (typeofValue=='object' && typeofDestiny!='object' && typeofDestiny!='array') {
2137+
dop.set(destiny, prop, dop.util.merge({}, value));
2138+
return true;
2139+
}
2140+
2141+
// Set value
2142+
else if (typeofValue!='object')
2143+
dop.set(destiny, prop, value);
2144+
2145+
}
2146+
// }
2147+
};
2148+
// dop.core.setActionLoop = function() {
2149+
// if (prop === dop.cons.DOP)
2150+
// return true;
2151+
// };
2152+
2153+
2154+
2155+
2156+
21552157
////////// src/core/objects/storeMutation.js
21562158

21572159
dop.core.storeMutation = function(mutation) {

dist/browser.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)