fh-sync-js
Advanced tools
Comparing version 1.0.0-rc1 to 1.0.0
{ | ||
"name": "fh-js-sdk", | ||
"version": "2.17.0", | ||
"homepage": "https://github.com/feedhenry/fh-js-sdk", | ||
"name": "fh-sync-js", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/feedhenry/fh-sync-js", | ||
"authors": [ | ||
"npm@feedhenry.com" | ||
], | ||
"description": "FeedHenry JS SDK", | ||
"main": "dist/feedhenry.js", | ||
"description": "Feedhenry sync", | ||
"main": "dist/fh-sync.js", | ||
"keywords": [ | ||
"feedhenry", | ||
"mobile", | ||
"html5", | ||
"mbaas", | ||
"sdk" | ||
"fhsync" | ||
], | ||
"license": "Copyright (c) 2014 FeedHenry Ltd, All Rights Reserved.", | ||
"license": "Apache 2.0 License", | ||
"ignore": [ | ||
@@ -19,0 +17,0 @@ "**/.*", |
@@ -95,4 +95,3 @@ // Type definitions for fh-sync-js 2.18.0 | ||
*/ | ||
function notify(callback: NotifyCallback); | ||
function notify(dataset_id:string, callback:NotifyCallback); | ||
/** | ||
@@ -186,3 +185,3 @@ * Put a dataset under the management of the sync service. | ||
*/ | ||
function startSync(datasetId: string, success: () => void, failure: Function); | ||
function startSync(datasetId: string, success: () => void, failure?: (obj: any) => void); | ||
@@ -196,3 +195,3 @@ /** | ||
*/ | ||
function stopSync(datasetId: string, success?: () => void, failure?: (err: string, datasetId: string) => void); | ||
function stopSync(datasetId: string, success?: () => void, failure?: (obj: any) => void); | ||
@@ -224,3 +223,3 @@ /** | ||
*/ | ||
function listCollisions(datasetId: string, success: (res: any) => void, failure: (msg: string, err: any) => void); | ||
function listCollisions(datasetId: string, success: (res: any) => void, failure?: (msg: string, err: any) => void); | ||
@@ -322,3 +321,3 @@ /** | ||
*/ | ||
function setCloudHandler(handler: (params: any, success: function, failure: function) ); | ||
function setCloudHandler(handler: (params: any, success: Function, failure: Function) => void); | ||
} | ||
@@ -325,0 +324,0 @@ } |
@@ -56,3 +56,2 @@ var path = require('path'); | ||
"http://127.0.0.1:8200/test/browser/index.html?url=http://localhost:9999", | ||
"http://127.0.0.1:8200/test/browser/index-require.html" | ||
] | ||
@@ -59,0 +58,0 @@ } |
@@ -1,1 +0,1 @@ | ||
This dir is for third party libraries. To add a library to the final dist/feedhenry-latest.js you will need to add it to the grunt.js file | ||
This dir is for third party libraries. To add a library to the final dist you will need to add it to the grunt.js file |
{ | ||
"name": "fh-sync-js", | ||
"version": "1.0.0-rc1", | ||
"version": "1.0.0", | ||
"description": "Javascript client for fh-sync offline synchronization library", | ||
"main": "dist/fh-sync.js", | ||
"main": "src/index.js", | ||
"types": "./fh-js-sdk.d.ts", | ||
@@ -19,3 +19,3 @@ "browserify-shim": { | ||
"browserify": { | ||
"standalone": "feedhenry", | ||
"standalone": "fh-sync", | ||
"transform": [ | ||
@@ -22,0 +22,0 @@ "browserify-shim" |
@@ -7,43 +7,30 @@ FeedHenry Sync Javascript client | ||
## Building | ||
## Required setup | ||
The JS SDK is now built using [Browserify](http://browserify.org/). | ||
Sync client using default Ajax handler to call sync server. | ||
Server URL can be configured using following variables | ||
### Development | ||
- cloudUrl - URL to sync server | ||
- cloudPath (optional) - allows to use custom endpoint for sync (defaults to `/sync/`) | ||
Because of Browserify, you can write any new functions as normal node modules, and use node's "require" to load any other modules, or to be consumed by other modules. | ||
### Testing | ||
Write your tests in test/tests directory. Add the tests to test/browser/suite.js file and run | ||
For example: | ||
```javascript | ||
syncClient.init({ | ||
cloudUrl:"http://localhost:3000", | ||
do_console_log: true, | ||
sync_frequency: 1, | ||
sync_active: false, | ||
storage_strategy: ['memory'], | ||
crashed_count_wait: 0 | ||
}); | ||
``` | ||
grunt test | ||
``` | ||
This will use mocha and phatomjs to run the tests. | ||
## Building | ||
In fact, if your module and test don't require a browser environment, you can just run them purely in node. (You may need to add a new grunt task to run them). | ||
npm install | ||
grunt | ||
To help debugging, you can run | ||
## Relation for fh-js-sdk | ||
``` | ||
grunt local | ||
``` | ||
Feedhenry JS SDK contains various libraries and also includes fh-sync-js library. | ||
This will start mock servers locally and you can go to http://localhost:8200/example/index.html page to debug. You may want to run | ||
``` | ||
grunt watch | ||
``` | ||
In another terminal window to auto generate the combined js sdk file. | ||
### Build | ||
When finish developing and testing, run | ||
``` | ||
grunt | ||
``` | ||
To generate the release builds. |
@@ -5,2 +5,4 @@ var api_sync = require("./sync-client"); | ||
var fh = window.$fh = window.$fh || {}; | ||
fh.sync = api_sync; | ||
fh.sync = api_sync; | ||
module.exports = fh.sync; |
var CryptoJS = require("../libs/generated/crypto"); | ||
var Lawnchair = require('../libs/generated/lawnchair'); | ||
var defaultCloudHandler = require('./cloudHandler'); | ||
@@ -103,2 +104,3 @@ var self = { | ||
} | ||
defaultCloudHandler.init(self.config.cloudUrl, self.config.cloudPath); | ||
}, | ||
@@ -117,3 +119,3 @@ | ||
// Currently we do not enforce the rule that init() funciton should be called before manage(). | ||
// Currently we do not enforce the rule that init() function should be called before manage(). | ||
// We need this check to guard against self.config undefined | ||
@@ -1224,6 +1226,6 @@ if (!self.config){ | ||
self.config = self.defaults; | ||
//Initialse the sync service with default config | ||
//self.init({}); | ||
})(); | ||
self.setCloudHandler(defaultCloudHandler.handler); | ||
module.exports = { | ||
@@ -1257,3 +1259,4 @@ init: self.init, | ||
clearCache: self.clearCache, | ||
setCloudHandler: self.setCloudHandler | ||
setCloudHandler: self.setCloudHandler, | ||
doCloudCall: self.doCloudCall | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
460109
31
12019
36
5
2