PouchDB snippets for Sublime Text.
PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser. Was created to help web developers build applications that work as well offline as they do online.
To install through Package Control, search for PouchDB. If you still don't have Package Control in Sublime Text, go get it. If you insist to not install it, you can download the package and put it manually inside your Pacakages directory. It should work but will not update automatically.
To trigger a snippet just put a pdb- followed by it's name, like so:
trigger: pdb-new⇥
var db = new PouchDB('dbName', options);trigger: pdb-destroy⇥
db.destroy('dbName', function(err, res) {
// your code goes here
});trigger: pdb-put⇥
db.put(doc, function(err, res) {
// your code goes here
});trigger: pdb-post⇥
db.post(doc, function(err, res) {
// your code goes here
});trigger: pdb-get⇥
db.get('doc', function(err, res) {
// your code goes here
});trigger: pdb-remove⇥
db.remove('doc', function(err, res) {
// your code goes here
});trigger: pdb-bulkDocs⇥
db.bulkDocs(docs, function(err, res) {
// your code goes here
});trigger: pdb-allDocs⇥
db.allDocs(options, function(err, res) {
// your code goes here
});trigger: pdb-changes⇥
db.changes(options);trigger: pdb-replicate⇥
db.replicate.type(remoteDB, options);trigger: pdb-sync⇥
var sync = PouchDB.sync(src, target, options);trigger: pdb-putAttachment⇥
db.putAttachment(docId, attachmentId, rev, doc, type, function(err, res) {
// your code goes here
});trigger: pdb-getAttachment⇥
db.getAttachment(docId, attachmentId, options, function(err, res) {
// your code goes here
});trigger: pdb-removeAttachment⇥
db.removeAttachment(docId, attachmentId, rev, function(err, res) {
// your code goes here
});trigger: pdb-query⇥
db.query(fun, options, function(err, res) {
// your code goes here
});trigger: pdb-info⇥
db.info(function(err, res) {
// your code goes here
});trigger: pdb-compact⇥
db.compact(options, function(err, res) {
// your code goes here
});trigger: pdb-revsDiff⇥
db.revsDiff(diff, function(err, res) {
// your code goes here
});trigger: pdb-event⇥
PouchDB.on('event', function(dbName) {
// your code goes here
});trigger: pdb-plugin⇥
PouchDB.plugin({
methodName: myFunction
});- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -m "Add some feature" - Push to the branch:
git push origin my-new-feature - Submit a pull request :)
English is the universal language nowadays, so please don't create or comment on issues using another language.
For detailed changelog, see Releases.
MIT License © Breno Polanski
