Git Product home page Git Product logo

nowpad's Introduction

Note

These days there is now ShareJS. You should probably use that instead.

Nowpad is no longer maintained and the now dependency that nowpad depends on no longer works. Theoritically, the now dependency could be swapped out for primus, which should take about half a day, but that is not guaranteed to work.

NowPad: Realtime Text Collaboration

Build Status NPM version Dependency Status Development Dependency Status
Gittip donate button Flattr donate button PayPayl donate button BitCoin donate button Wishlist browse button

NowPad adds realtime text collaboration to parts of your website such as textareas, allowing multiple people to work on the same document at the same time (while seeing each others changes as they are applied). The benefit of this over traditional collaborative editing is two people would be editing the same document, they've both made changes, one person saves, and the other has to make the choice 'lose my changes, or lose his changes'. Nowpad keeps and applies both your changes as they happen.

Install

  • Use: require('nowpad')
  • Install: npm install --save nowpad

It Uses

  • Node.js - Server Side Javascript
  • Express.js - The "Server" in Server Side Javascript
  • Now.js - Server and Client Side Communication
  • CoffeeScript - JavaScript Made Easy
  • Buildr - (Java|Coffee)Script Bundling Made Easy

Demo

  1. Clone and setup this repo

     git clone https://github.com/balupton/nowpad.git nowpad
     cd nowpad
     npm install
     npm link
    
  2. Start the demo app

     nowpad  # or npm start if inside nowpad directory
    

Implementing

Server Side

// Include NowPad
var nowpad = require('nowpad')

// Setup with your Express Server
var myNowpad = nowpad.createInstance({server: yourExpressServer})

	//Create known documents
myNowpad.addDocument('doc1', 'this is doc1')
myNowpad.addDocument('doc2', 'this is doc2')

// Handle unknown document
// Fires when an unknown document is requested
myNowpad.requestDocument(function(documentId, callback){
	// nowpad.addDocument(documentId)
	// callback(true)
	callback false
})

// Handle sync request
// Fires when a change is synced to the document
myNowpad.bind('sync', function(document, value){

})

// Handle disconnect request
// Fires when all the clients have disconnected from a document
myNowpad.bind('disconnected', function(document, value){

})

Client Side

  1. Include Dependencies

    <script src="/nowjs/now.js"></script>
    <script src="/nowpad/nowpad.js"></script>
  2. Using NowPad with a Textarea

    // Without jQuery
    window.nowpad.createInstance({
    	element: document.getElementById('myTextarea'),
    	documentId: 'doc1'
    });
    
    // Or With jQuery
    $textarea = $('#myTextarea').nowpad('doc1');
  3. Using NowPad with ACE

    window.nowpad.createInstance({
    	element: ace.edit('pad'),
    	documentId: 'doc1'
    });

Learning

History

Discover the change history by heading on over to the HISTORY.md file.

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

Gittip donate button Flattr donate button PayPayl donate button BitCoin donate button Wishlist browse button

Contributors

These amazing people have contributed code to this project:

Become a contributor!

License

Licensed under

Copyright ยฉ 2011+ Benjamin Lupton [email protected] (https://github.com/balupton)

nowpad's People

Contributors

balupton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.