Greetings fellow keyboard masher,
This is a PhoneGap plugin that allows you to retrieve a PhoneGap app being served from a server and as well as being able to easily update that app.
Note: this plugin is still pretty new so expect some changes!
phonegap plugin add https://github.com/phonegap/phonegap-plugin-contentsync
- iOS (in the works)
- Android (in the works)
- WP8 (in the works)
var sync = ContentSync.sync({ src: 'http://myserver' });
sync.on('progress', function(data) {
// data.progress - Integer value representing progress precentage
});
sync.on('complete', function(data) {
// data.localPath - browser-compatible path to the sync'd content
});
sync.on('error', function(e) {
// e - Error object that describes the error
});
sync.on('cancel', function() {
// trigged if event is cancelled
});
Parameters:
- options: (Object)
- src: (String) Remote destination to grab content.
- [type]: (String) Sets the merge strategy for new content. Optional.
- replace: This is the normal behavior. Existing content is replaced completely by the imported content, i.e. is overridden or deleted accordingly. (Default)
- merge: Existing content is not modified, i.e. only new content is added and none is deleted or modified.
- update: Existing content is updated, new content is added and none is deleted.
Returns:
- Instance of
ContentSync
.
Example:
var sync = ContentSync.sync({ src: 'http://myserver' });
Parameters:
- event: (String). Describes which event you want to subscribe to.
- progress: Fires when the native portion begins to download the content and returns progress updates.
- data.progress: (Integer) between 0 - 100.
- complete: Fires when we have successfully downloaded from the source.
- data.localpath (String) is a file path to content that is usable by browser.
- error: Fires when an error occured.
- e: (Error) describes the error.
- cancel: Fires when we use sync.cancel();
- progress: Fires when the native portion begins to download the content and returns progress updates.
- callback: (Function). Triggered on the event.
The project uses .editorconfig to define the coding style of each file. We recommend that you install the Editor Config extension for your preferred IDE.
The project uses .jshint to define the JavaScript coding conventions. Most editors now have a JSHint add-on to provide on-save or on-edit linting.
- Install jshint.
- Install jshint.vim.
- Install Package Control
- Restart Sublime
- Type
CMD+SHIFT+P
- Type Install Package
- Type JSHint Gutter
- Sublime -> Preferences -> Package Settings -> JSHint Gutter
- Set
lint_on_load
andlint_on_save
totrue