atajox-lib
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -71,2 +71,3 @@ 'use strict'; | ||
if (!this.processInterval) { | ||
setTimeout(function () { _this.process(); }, 1000); | ||
this.processInterval = setInterval(function () { | ||
@@ -73,0 +74,0 @@ _this.process(); |
@@ -10,2 +10,3 @@ export declare class AtajoXTime { | ||
isDeviceTimeValid(): Promise<{}>; | ||
private getTimeFromCore(); | ||
/** | ||
@@ -12,0 +13,0 @@ * Get time from zone |
'use strict'; | ||
var request = require('request'); | ||
import { atajoXConfig } from '../config/config'; | ||
import { atajoXApi } from "../api/api"; | ||
var AtajoXTime = /** @class */ (function () { | ||
@@ -18,3 +19,3 @@ function AtajoXTime() { | ||
return new Promise(function (resolve, reject) { | ||
_this.getTimeFromZone('Africa/Johannesburg').then(function (data) { | ||
_this.getTimeFromCore().then(function (data) { | ||
if (data == null) | ||
@@ -29,5 +30,3 @@ resolve(false); | ||
var timeDifference = Math.abs(deviceTime - remoteTime); | ||
var gmtOffset = data['gmtOffset']; | ||
var timeDeviation = timeDifference - gmtOffset; | ||
if (timeDeviation > maxDeviation) { | ||
if (timeDifference > maxDeviation) { | ||
resolve(false); | ||
@@ -44,2 +43,9 @@ } | ||
}; | ||
AtajoXTime.prototype.getTimeFromCore = function () { | ||
return new Promise(function (resolve, reject) { | ||
atajoXApi.addTransaction('@atajo-time/v1/time/now', {}, { timeout: 180000 }).subscribe(function (result) { | ||
resolve(result.data); | ||
}, function (error) { reject(); }, function () { }); | ||
}); | ||
}; | ||
/** | ||
@@ -46,0 +52,0 @@ * Get time from zone |
{ | ||
"name": "atajox-lib", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "AtajoX API Library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -1,2 +0,2 @@ | ||
*Global installs* | ||
## Global installs | ||
@@ -7,3 +7,3 @@ $ npm install -g karma-cli | ||
*Available Plugins* | ||
## Available Plugins | ||
@@ -19,3 +19,3 @@ cordova-plugin-app-version | ||
*Database Support* | ||
## Database Support | ||
@@ -32,5 +32,53 @@ https://ionicframework.com/docs/storage/ | ||
## Code Push Support | ||
*Start tests* | ||
`$ cordova plugin add https://github.com/k1dbl4ck/cordova-plugin-atajo-update.git` | ||
Remember to remove the old code push first. | ||
In Ionic2: | ||
``` | ||
platform.ready(() => { | ||
atajoXConfig.set('domain', {your-domain-name}); | ||
let update = new AtajoXUpdate(); | ||
update.checkForUpdates(); | ||
}); | ||
``` | ||
The following events can be listened through atajoXEvents: | ||
``` | ||
'atajo:update:initialized', | ||
'atajo:update:filesystem:ready', | ||
'atajo:update:folder:ready', | ||
'atajo:update:error', | ||
'atajo:update:download:success', | ||
'atajo:update:download:error', | ||
'atajo:update:download:progress', | ||
'atajo:update:unzip:success', | ||
'atajo:update:unzip:error', | ||
'atajo:update:unzip:progress', | ||
'atajo:update:file:remove:success', | ||
'atajo:update:file:remove:error', | ||
'atajo:update:file:get:error' | ||
``` | ||
Example: | ||
``` | ||
import {atajoXEvents} from 'atajox-lib'; | ||
... | ||
atajoXEvents.subscribe('atajo:update:file:remove:success', (data) => { | ||
// update installed successfully | ||
}); | ||
... | ||
``` | ||
## Start tests | ||
$ karma start |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
322555
5161
82