0.1.3-0 • Published 12 years ago

synchroscope v0.1.3-0

Weekly downloads
3
License
-
Repository
github
Last release
12 years ago

synchroscope ($YNC) (Build Status)

For interactive web applications that are to be run on multiple devices at the same time, synchroscope makes it very easy to share scope variables.

Client

synchroscope uses Function.prototype.bind which is unavailable in some older browsers (such as iOS5 Safari). Please use es5-shim if you want to target those.

Symlink or copy client/sync.js to your Angular project, and include it like this.

<script src="path/to/es5-shim.js"></script>
<script src="path/to/sync.js"></script>

Then, declare a dependency on synchroscope module, ask for the $ync service, and just call it:

angular.module('myApp', ['synchroscope'])
  .controller('MyController', function($scope, $ync) {

    $scope.hello = 'initial data'
    $scope.world = 'for synchroscope demo'
    $scope.foo = 'TRY IT!'

    var keys = ['hello', 'world']  // keys that you want to share
    var room = 'test'              // room name
    var sync = $ync($scope, keys, room)
    
  })

As soon as you call $ync, the keys hello and world will be synchronized across all browser clients.

Server

Let's assume that io is a Socket.IO server object obtained by something like this: var io = require('socket.io').listen(server). Just add this line to your server:

require('synchroscope').listen(io.of('/synchroscope'))

License

MIT.

0.1.3-0

12 years ago

0.1.2-0

12 years ago

0.1.1-0

12 years ago

0.1.0-0

12 years ago

0.0.3

12 years ago