Git Product home page Git Product logo

dpd-titanium's Introduction

dpd.js for Appcelerator Titanium

This is a Titanium JavaScript module that lets a Titanium app communicate with a deployd backend.

prerequisites

  • You'll need deployd installed first.
  • You'll need Appcelerator Titanium installed, as well as either the iOS or Android SDK.

usage

Make sure your deployd app is running, and has a resource to communicate with. Also make sure your app has dpd.js available (from Resources/dpd.js)

  // Init deployd module and create an object in a collection.
  dpd = require('dpd');
  dpd.init({root:'http://localhost:2403'});
  dpd('collectionName').post({"title":"I <3 deployd"}, function (res, err){
    if (err) Ti.API.error(err);
    Ti.API.debug('Object created'+JSON.stringify(res));
  });

  // Get an object from a collection
  dpd('collectionName').get({"comments":{"$gte":5}}, fn);
  
  // Update an object in a collection
  dpd('collectionName').put("1a2b3c", {"title": "New Title"}, fn);

  // Delete an object in a collection
  dpd('collectionName').del("1a2b3c", fn)

  // Execute an arbitrary function, such as login.
  dpd('users').exec('login', {"username":"jeffbcross", "password":"cats"}, fn);

The dpd object mostly implements the same API as described in the deployd docs, the main difference being that all resources have to be accessed by calling the dpd('resourceName') function with the Resource name, instead of the standard dpd['resourceName'] convention.

  dpd('collection').post({"title": "Test post"}, fn);

use the example app

  1. Create a new Titanium project, and swap the Resources directory with the included Resources directory.
  2. Start the deployd app from Terminal/Command Prompt, and open your dashboard.
  cd /deploydapp
  dpd -d
  1. From Titanium Studio, run the project in iOS simulator.
  2. Watch the test output in the app's main window.

todo

  1. Implement socket.io
  2. Implement login methods
  3. Make a login window?

dpd-titanium's People

Contributors

iantearle avatar jeffbcross avatar

Watchers

 avatar  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.