Skip to content

Commit 17b80f7

Browse files
committed
Removed unobserve method in observer object
1 parent 71e2a09 commit 17b80f7

File tree

4 files changed

+35
-31
lines changed

4 files changed

+35
-31
lines changed

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,21 @@
88
<a href="https://gitter.im/DistributedObjectProtocol/dop?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img alt="Join the chat at" src="https://badges.gitter.im/DistributedObjectProtocol/dop.svg"></a>
99
</p>
1010

11-
## What is dop?
11+
## Distributed Object Protocol is for
1212

13-
Distributed Object Protocol is for Data-sync, Pub/Sub, Remote procedure calls, Reactive programming,
14-
Optimistic updates, Time-travel debugging, State management,
15-
Unidirectional data flow, Real time apps and more.
13+
**State management**, Remote procedure calls, Reactive programming,
14+
Data sync, Pub/Sub, Optimistic updates, Time-travel debugging, Unidirectional data flow and **Real time apps**.
1615

1716
This repository is the JavaScript implementation of the protocol that runs on node.js and Browsers.
1817

19-
20-
## Basic example
18+
<!--
19+
## Connecting two nodes
2120
2221
```js
2322
// Server (node.js)
2423
const dop = require('dop')
2524
const object = dop.register({
26-
hello: 'world',
25+
fullname: 'John Doe',
2726
square: number => number * number
2827
})
2928
dop.listen() // WebSockets on port 4444 (https://github.com/websockets/ws)
@@ -35,11 +34,15 @@ dop.onSubscribe(() => object)
3534
import dop from 'dop'
3635
const server = dop.connect() // Native WebSockets 'ws://localhost:4444'
3736
const objectFromServer = await server.subscribe()
38-
console.log(objectFromServer.hello) // > "world"
37+
console.log(objectFromServer.fullname) // > "John Doe"
3938
console.log(await objectFromServer.square(5)) // > 25
40-
```
39+
```-->
40+
41+
42+
43+
4144

42-
Check the website for more detailed documentation [https://distributedobjectprotocol.org/](https://distributedobjectprotocol.org/)
45+
Check the website for more detailed information [https://distributedobjectprotocol.org/](https://distributedobjectprotocol.org/)
4346

4447

4548

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dop",
3-
"version": "0.21.2",
3+
"version": "0.22.0",
44
"main": "./dist/dop.nodejs.js",
55
"browser": "./dist/dop.js",
66
"unpkg": "./dist/dop.min.js",
@@ -57,6 +57,7 @@
5757
"grunt": "grunt",
5858
"build": "grunt --build",
5959
"test": "tap test/**.js test/protocol/**.js",
60+
"test-proxy": "tap test/**.js test/protocol/**.js --test-arg=proxy",
6061
"test-electron": "browserify test/protocol/*.js test/*.js | tape-run --render=\"faucet\"",
6162
"test-chrome": "browserify test/protocol/*.js test/*.js | tape-run --render=\"faucet\" --browser chrome",
6263
"test-safari": "browserify test/protocol/*.js test/*.js | tape-run --render=\"faucet\" --browser safari",

src/core/api_transports/emitMessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dop.core.emitMessage = function(node, message_string, message_raw) {
1010
var messages;
1111

1212
// Parsing messages
13-
if (typeof message_string == 'string' && message_string.substr(0,1) == '[') {
13+
if (typeof message_string == 'string' && message_string[0] == '[') { // https://jsperf.com/slice-substr-substring-test
1414
try { messages = dop.decode(message_string, node); }
1515
catch(e) { /*console.log(e);*/ }
1616
}

src/core/constructors/observer.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,27 @@ dop.core.observer.prototype.observe = function(object, property) {
3939
};
4040

4141

42-
dop.core.observer.prototype.unobserve = function(object, property) {
43-
dop.util.invariant(dop.isRegistered(object), 'observer.unobserve() needs a registered object as first parameter');
44-
var path = dop.getObjectPath(object);
45-
dop.util.invariant(isArray(path), 'observer.unobserve() The object you are passing is not allocated to a registered object');
42+
// dop.core.observer.prototype.unobserve = function(object, property) {
43+
// dop.util.invariant(dop.isRegistered(object), 'observer.unobserve() needs a registered object as first parameter');
44+
// var path = dop.getObjectPath(object);
45+
// dop.util.invariant(isArray(path), 'observer.unobserve() The object you are passing is not allocated to a registered object');
4646

4747

48-
var path_id = dop.core.getPathId(path);
49-
data_path = dop.data.path,
50-
type = 'observers';
51-
52-
// is observeProperty
53-
if (arguments.length === 2) {
54-
type = 'observers_prop';
55-
path_id += dop.core.pathSeparator(property);
56-
}
57-
58-
if (data_path[path_id] !== undefined && data_path[path_id][type] !== undefined) {
59-
delete data_path[path_id][type][this.id];
60-
delete this[type][path_id];
61-
}
62-
};
48+
// var path_id = dop.core.getPathId(path);
49+
// data_path = dop.data.path,
50+
// type = 'observers';
51+
52+
// // is observeProperty
53+
// if (arguments.length === 2) {
54+
// type = 'observers_prop';
55+
// path_id += dop.core.pathSeparator(property);
56+
// }
57+
58+
// if (data_path[path_id] !== undefined && data_path[path_id][type] !== undefined) {
59+
// delete data_path[path_id][type][this.id];
60+
// delete this[type][path_id];
61+
// }
62+
// };
6363

6464

6565
dop.core.observer.prototype.destroy = function() {

0 commit comments

Comments
 (0)