-
Notifications
You must be signed in to change notification settings - Fork 454
Changelog
0.8 is a much more minor release than 0.7 was. A lot of APIs are being revisited & cleaned up. Some features which exist in 0.7 are being removed from sharejs.
The plan:
- Tests for everything
- Example code
- Queries will have
docMode:'subscribe'
removed. If you want to subscribe to query results, do it yourself. - bulkSubscribe / bulkFetch are being renamed 'subscribe' and 'fetch'. (I'm going to make those methods work with a list or something).
- The REST API and middleware have been pulled out to share/rest and share/middleware respectively. ShareJS now only contains code to manage the streaming client/server API.
- The subscription callback has been removed
- Moved to browserify
- Removed microevent. Doc, Connection and Query are nodejs
EventEmitter
objects now. (Thanks browserify!)
The API has frozen, and further API changes will be released in the 0.8 refactoring.
Fixed a longstanding bug with query subscriptions. The bug was triggered if you had an outstanding query with docMode:'sub'
, created a document in the client and then the document was edited immediately by middleware. This has been fixed by disabling docMode:sub and emulating it in the client.
Presence & cursors are implemented in sharejs, but they aren't supported in livedb yet.
Its all new code That means, new bugs, new APIs across the whole stack. Watch a video with the new features.
-
Documents are now namespaced by collection
-
Create and delete are now document operations, and documents all implicitly exist at version 0. Generally your 'version 0 op' will create the document (which gives it a type). Subsequent ops edit the document.
-
Due to popular demand, documents can be created with data.
-
Types no longer guarantee that
apply
preserves the old document object. This is good for performance, but bad for lots of other reasons. -
Type APIs have been redesigned. Call
ctx = doc.createContext()
for an editing context, thenctx.insert()
,ctx.remove()
, etc to edit the document via the context. Contexts route operations to each other correctly, so you can now have a document bound to multiple different elements on a page. -
Text API 'delete' callback tells you the position and length, not the position and deleted text.
-
on 'remoteop'
andon 'changed'
document events have been replaced withon 'op'
. It is called with(op, context)
. By default, context is truthy for local edits and false for remote edits. -
Added an
on 'before op'
emitter to allow the inspection of snapshots before operations edit them. -
You can't submit ops in the
on 'op'
callback. Do it in aon 'after op'
callback. -
Connections aren't assumed, and aren't provided by default. Check the examples.
-
The client no longer caches all operations its ever seen. This means you can't submit an op on the client at an old version - which was a feature I don't think anybody anywhere was using.
-
Microevent is no longer chainable (foo.on('hi', function(){}).on(…).emit('hi') ) in order to make it compatible with NodeJS's event emitter API.
-
Documents are editable before they have a snapshot. This allows you to create new documents and set their content without consulting the server.
-
Documents can submit operations to the server while unsubscribed. The document will be brought up to date as each operation is sent to the server.
-
Queries have been added. You can make a fetch query or a subscribed query. Fetch queries basically just forward a mongo (or whatever) query to the database. Subscribe queries re-poll as data is edited. Take a look at the list example, which is being fleshed out at project godbox.
-
All of ShareJS has been rewritten in javascript.
-
ShareJS's live backend has been moved to livedb. All the database bindings should move there.
- Moved to MIT license
- Fixed
this
binding and addedonce
to microevent - Fixed bugs (@joshuapurcell)
- Removed socket.io support. Stop using it.
- Fixed some bugs (thanks @wmertens, @themgt, @rissem)
- Added reconnect support for websockets and sockjs (thanks @dcolens)
- Moved to ShellJS for build (Thanks @wmertens)
- Etherpad support! (Thanks @jucovschi)
- Fixed bugs in MySQL and redis backends (Thanks @livelily and @mluto)
- Added postgresql support (Thanks @nullobject, @collin, and anyone I'm forgetting)
- Added authenticated redis database parameters (thanks @thegoleffect)
- Rewrote the client connection code.
- It now uses browserchannel.
- Changed
connection.on('connect')
toconnection.on('ok')
. - Added automatic reconnection and resyncing to the client code
- New bugs!
- By default listening URL is browserchannel's default of
/channel
instead of/sjs
. I might change this back; I'm not sure.
- The socket.io frontend is turned off by default
- Changes to the wire protocol
- Added duplicate op detection
- Added auth message, which tells the client its session ID
- Renamed
Client
toUserAgent
- Renamed
agent.id
toagent.sessionId
- Added
agent.name
optional field which you can use to tell everyone a client's id
Action required: The server and client APIs have changed. Errors are now passed as the first argument to all callbacks. This means:
client.open('hello', 'text', function(doc, error) {
// ...
});
becomes
client.open('hello', 'text', function(error, doc) {
// ...
});
This change also affects the (undocumented) server APIs. Update your code!
- Renamed the 'listen' auth request to 'open'.
- Put a caching layer around the database, which reduces the number of database queries by a factor of 3-4x.
- CouchDB support! (Thanks @maxogden)
- JSON OT has a nice new API! (Thanks @nornagon)
- For consistency with nodejs, made all callback functions all pass an error as the first callback argument.
- Swapped from tabs to spaces project-wide.
- Removed the need to compile the server. The project now depends on coffeescript directly and is compiled when its require()'ed.
- Ops are stored with source:client.id now instead of using the socketio id
- Added node-browserchannel support in the server
- Rewrote the demo page
- Giant refactor / rewrite of the server code
- The model is now an event emitter. You can do
model.on 'create', (docName) -> ...
to initialize documents with data. - Added docs for the restful web frontend
- Switched to from Closure to UglifyJS - Blog post
- Removed
remotePort
from auth'sclient
object. (Its not actually useful). I know this changes the api, I'm naughty. - Removed the junky comment header at the top of the compiled code
- Fixed running
sharejs-exampleserver
from the command line after installing sharejs globally. - Added some missing tests (The people demand more tests!)
- Swapped across to node-hat for generating IDs
Action required: Anyone using the JSON type must explicitly include <script src='share/json.js'/>
Action required: Manually specifying a hostname to connect to is now in the new socket.io style. See client docs for details.
Action required: The optional version parameter on doc.submitOp
has been removed, because it really doesn't seem useful. File an issue if I'm wrong.
- Improved support for sharejs types to live outside of the compiled code bundle.
- The JSON type now compiles separately (to
json.js
). This has reduced the standard share.js client size significantly (14k -> 9.5k). - Renamed
Document
toDoc
to avoid confusion withwindow.Document
- Changed the textarea code to use the new text API.
- ShareJS now uses socket.io 0.8 up from 0.6. Unfortunately, socket.io has lots of bugs related to connecting / disconnecting. If there are any more stable alternatives to socket.io, I'm happy to talk about moving.
- ShareJS now supports User access control!
-
Connection.open
now behaves better when the connection has been disconnected, or is disconnected while the document is being opened. - REST
options.delete
has been removed in favor of specifying an authentication function.
Action required: Anyone using the ace editor should include <script src='share/ace.js'/>
instead of <script src='share/share-ace.js'/>
- Added support for type-specific APIs to be added to Document. Blog post
- Added
window.sharejs.version
andrequire('share').version
fields - Added more tests for the closure compiled code
- Removed documentation in /docs (thats what the wiki is for)
- Rewrote ace editor code to use new text API instead of generating ops directly
- Updated to the most recent version of ace (Issue #21)
- Renamed
share-ace.js
toace.js
. Code using the ace editor should be updated.share-ace.js
is still there for now, but it will be removed in a subsequent version of ShareJS.