Permalink
Browse files

Updated all examples to use the new callback style

  • Loading branch information...
1 parent 9312512 commit a58a7a919ef10fb15b43e030865d04db597cfb30 @josephg committed Oct 28, 2011
View
@@ -143,7 +143,7 @@ And add this code:
<script>
var editor = ace.edit("editor");
- sharejs.open('hello', 'text', function(doc, error) {
+ sharejs.open('hello', 'text', function(error, doc) {
doc.attach_ace(editor);
});
</script>
@@ -170,7 +170,7 @@ Run this from a couple terminal windows when sharejs is running to see it go.
var client = require('share').client;
// Open the 'hello' document, which should have type 'text':
-client.open('hello', 'text', 'http://localhost:8000/sjs', function(doc, error) {
+client.open('hello', 'text', 'http://localhost:8000/sjs', function(error, doc) {
// Insert some text at the start of the document (position 0):
doc.insert("Hi there!\n", 0);
@@ -9,7 +9,7 @@ catch e
template = fs.readFileSync "#{__dirname}/template.html.mu", 'utf8'
module.exports = (docName, model, res, next) ->
- model.getSnapshot docName, (data) ->
+ model.getSnapshot docName, (error, data) ->
if data == null
# The document does not exist
next()
@@ -37,7 +37,7 @@ module.exports = (docName, model, res) ->
name = docName
docName = "wiki:" + docName
- model.getSnapshot docName, (data) ->
+ model.getSnapshot docName, (error, data) ->
if data == null
model.create docName, 'text', ->
content = defaultContent(name)
@@ -36,7 +36,7 @@
var connection = new sharejs.Connection('http://' + window.location.hostname + ':' + 8000 + '/sjs');
- connection.open('{{{docName}}}', function(doc, error) {
+ connection.open('{{{docName}}}', function(error, doc) {
if (error) {
console.error(error);
return;
View
@@ -26,7 +26,7 @@
editor.setReadOnly(true);
document.title = docName;
- sharejs.open(docName, function(newDoc, error) {
+ sharejs.open(docName, function(error, newDoc) {
if (doc != null) {
doc.close();
@@ -22,7 +22,7 @@
<script>
var editor = ace.edit("editor");
-sharejs.open('smash', 'text', function(doc, error) {
+sharejs.open('smash', 'text', function(error, doc) {
doc.attach_ace(editor, true);
});
</script>
View
@@ -22,7 +22,7 @@
<script>
var editor = ace.edit("editor");
-sharejs.open('hello', 'text', function(doc, error) {
+sharejs.open('hello', 'text', function(error, doc) {
doc.attach_ace(editor);
});
</script>
View
@@ -3,7 +3,7 @@
var client = require('..').client;
-client.open('hello', 'text', 'http://localhost:8000/sjs', function(doc, error) {
+client.open('hello', 'text', 'http://localhost:8000/sjs', function(error, doc) {
doc.insert('Hi there\n', 0);
console.log(doc.snapshot);
@@ -16,7 +16,7 @@
<script>
var elem = document.getElementById('text');
-sharejs.open('hello', 'text', function(doc, error) {
+sharejs.open('hello', 'text', function(error, doc) {
elem.innerHTML = doc.snapshot;
doc.on('change', function() {
elem.innerHTML = doc.snapshot;
View
@@ -3,7 +3,7 @@
var client = require('..').client;
-client.open('hello', 'text', 'http://localhost:8000/sjs', function(doc, error) {
+client.open('hello', 'text', 'http://localhost:8000/sjs', function(error, doc) {
if (error) {
throw error;
}
View
@@ -23,7 +23,7 @@
<script>
var editor = ace.edit("editor");
-sharejs.open('hello-tp2', 'text-tp2', function(doc, error) {
+sharejs.open('hello-tp2', 'text-tp2', function(error, doc) {
doc.attach_ace(editor);
});
</script>
View
@@ -550,7 +550,7 @@
}
var docname = 'hex:' + document.location.hash.slice(1)
- sharejs.open(docname, 'json', function (doc, error) {
+ sharejs.open(docname, 'json', function(error, doc) {
$state = doc;
doc.on('change', function (op) {
stateUpdated(op)
View
@@ -31,7 +31,7 @@
var docName = "pad:" + document.location.hash.slice(1);
- sharejs.open(docName, 'text', function(doc, error) {
+ sharejs.open(docName, 'text', function(error, doc) {
if (error) {
console.error(error);
return;
@@ -12,7 +12,7 @@
var elem = document.getElementById('text');
- sharejs.open('html', 'text', function(doc, error) {
+ sharejs.open('html', 'text', function(error, doc) {
if (error) {
console.error(error);
} else {
@@ -17,7 +17,7 @@
// To convert markdown -> HTML
var converter = new Showdown.converter();
- sharejs.open('markdown', 'text', function(doc, error) {
+ sharejs.open('markdown', 'text', function(error, doc) {
if (error) {
console.error(error);
} else {
View
@@ -24,7 +24,7 @@
<script>
var elem = document.getElementById('editor');
-sharejs.open('hello', 'text', function(doc, error) {
+sharejs.open('hello', 'text', function(error, doc) {
if (error) {
console.log(error);
} else {

0 comments on commit a58a7a9

Please sign in to comment.