Skip to content

Commit ba5c7f1

Browse files
committed
Merge branch 'dev' of github.com:DistributedObjectProtocol/dop
* 'dev' of github.com:DistributedObjectProtocol/dop: Improved observer object and remove dop.observe from the API Changed the system of observers based absolute paths instead of storing inside of the object We update computed values after each recalculation to observe new derivations Only one array of collectors instead of two Merging observe and observeProperty with createObserver Fixeds some problematic cases in computed values Making computed/derived properties
2 parents 5936866 + c24fc8f commit ba5c7f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2003
-534
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Dependency directories
32
node_modules/
43

@@ -16,5 +15,6 @@ npm-debug.log*
1615
.grunt
1716

1817
# Files
18+
dist
1919
test*.*
2020
examples/todomvc

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<p align="center"><a href="https://distributedobjectprotocol.org"><img width="200"src="https://distributedobjectprotocol.org/img/logo.svg"></a></p>
33

44
<p align="center">
5-
<a href="https://www.npmjs.com/package/dop"><img alt="npm version" src="https://img.shields.io/npm/v/dop.svg"></a>
5+
<a href="https://www.npmjs.com/package/dop"><img alt="npm version" src="https://badge.fury.io/js/dop.svg"></a>
66
<a href="https://travis-ci.org/DistributedObjectProtocol/dop"><img alt="Build Status" src="https://travis-ci.org/DistributedObjectProtocol/dop.svg?branch=master"></a>
77
<a href="https://www.npmjs.com/package/dop"><img alt="license" src="https://img.shields.io/npm/l/dop.svg"></a>
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>
@@ -23,10 +23,11 @@ This repository is the JavaScript implementation of the protocol that runs on no
2323
// Server (node.js)
2424
const dop = require('dop')
2525
dop.listen() // WebSockets on port 4444 (https://github.com/websockets/ws)
26-
dop.onSubscribe(() => {
26+
const object = dop.register({
2727
hello: 'world',
2828
square: number => number * number
2929
})
30+
dop.onSubscribe(() => object)
3031
```
3132

3233
```js

examples/drag/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

examples/drag/client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
var server = dop.connect()
33
var circleServer = dop.register({});
44
server.subscribe().into(circleServer)
5-
dop.observe(circleServer, function() {
5+
var observer = dop.createObserver(function() {
66
// We shouldn't update position from others if we are alredy moving it localy
77
if (!circle.mover) {
88
circle.el.style.left = circleServer.x + 'px'
99
circle.el.style.top = circleServer.y + 'px'
1010
}
1111
})
12+
observer.observe(circleServer)
1213
// end dop
1314

1415

0 commit comments

Comments
 (0)