Skip to content
dropbox.js wrapper for Amber Smalltalk
JavaScript Smalltalk Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
js
st
LICENSE.txt
README.md
copyAll.bat
copyAll.sh
drop-todo.html
dropboxFromAmber.html

README.md

DropboxFromAmber

Newer: Dropbox Datastore API & dropbox.js wrapper for Amber Smalltalk.

Currently, new version is not documented yet. No sample codes. But Dropbox-Datastore.st is a package for the Datastore API support.

Legacy: dropbox.js wrapper for Amber Smalltalk

Installation

Just copy and merge the whole directory to your Amber Smalltalk home. Use copyAll.sh or copyAll.bat, according to your platform.

Usage

| dropboxCli |
dropboxCli := DrClient default.
dropboxCli authenticateThen: [
  dropboxCli writeFile: 'hello.txt' data: 'world'.
].

Setting API key

By default, DrClient create 'Amber_ToDo_Demo' app folder to your dropbox (for the convenience of the example below). You can change the app folder by obtaining your own API key from dropbox.

API key can be set by DrClient defaultApiKey: 'encoded api key'. The method only accepts encoded API key for security reasons. Encoding can be done by Dropbox API key encoder.

Changing Authentication Driver

DrClient's default authentication driver is Redirect. It is suitable in most cases.

However, in mobile devises, Cordova driver would be better.

You can explicitly set the driver by DrClient defaultAuthDriverType:'redirect|popup|chrome|cordova|nodeserver'. Please read dropbox.js authentication drivers document for the differences.

drop-todo.html is the example of setting API key and auth driver from JavaScript side.

smalltalk.DrClient._defaultApiKey_('lT8r2O3iMCA=|ULla/D4WPtfkec3nxbtR+V861w9E+U9+krMlTYrV/A==');
smalltalk.DrClient._defaultAuthDriverType_('cordova');

Example

Extended ToDoList Example

dropboxFromAmber includes an extended ToDoList example. While the original jqmFromAmber example stores data to html5 localStorage, this version saves tasks to Dropbox.

How to try the example:

  1. install the demo prerequisite -- jqmFromAmber. It is used for ToDoList UI.
  2. start amber server
  3. open the demo page (http://localhost:4000/dropboxFromAmber.html) with your favorite web browser.

See the 'Dropbox-ToDo' package for details.

License

MIT license

You can’t perform that action at this time.