Comparing version 0.0.4 to 0.0.5
@@ -149,11 +149,21 @@ "use strict"; | ||
dispatch: function dispatch(e) { | ||
var _this = this; | ||
$(this).dispatcher = new WebSocket(this.address); | ||
$(this).dispatcher.onopen = $(this).onOpen; | ||
$(this).dispatcher.onclose = $(this).onClose; | ||
$(this).dispatcher.onerror = $(this).onError; | ||
$(this).dispatcher.onmessage = $(this).onMessage; | ||
$(this).dispatcher.onopen = function (e) { | ||
return $(_this).onOpen(e); | ||
}; | ||
$(this).dispatcher.onclose = function (e) { | ||
return $(_this).onClose(e); | ||
}; | ||
$(this).dispatcher.onerror = function (e) { | ||
return $(_this).onError(e); | ||
}; | ||
$(this).dispatcher.onmessage = function (e) { | ||
return $(_this).onMessage(e); | ||
}; | ||
}, | ||
onOpen: function onOpen(e) { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -166,5 +176,5 @@ console.info("Api connected to \"" + this.address + "\""); | ||
beforeReadyPromise.then(function (e) { | ||
_this.trigger(_Events.API.READY, e); | ||
_this2.trigger(_Events.API.READY, e); | ||
}, function (e) { | ||
_this.trigger(_Events.API.UNREADY, e); | ||
_this2.trigger(_Events.API.UNREADY, e); | ||
}); | ||
@@ -180,4 +190,8 @@ } else console.warn("BeforeReadyPromise must be return instance of Promise"); | ||
onClose: function onClose(e) { | ||
var _this3 = this; | ||
console.warn("Api disconnected from \"" + this.address + "\""); | ||
setTimeout($(this).dispatch, $(this).reconnectDelay * 100); | ||
setTimeout(function () { | ||
return $(_this3).dispatch; | ||
}, $(this).reconnectDelay * 100); | ||
$(this).reconnectDelay += 1; | ||
@@ -200,7 +214,7 @@ this.trigger(_Events.API.DISCONNECT, e); | ||
var HANDLERS = (_HANDLERS = {}, _defineProperty(_HANDLERS, _Events.API.ALIVE, function (data) { | ||
var _this2 = this; | ||
var _this4 = this; | ||
if ($(this).aliveTimer) clearTimeout($(this).aliveTimer); | ||
if (this.aliveDelay) $(this).aliveTimer = setTimeout(function () { | ||
$(_this2).aliveTimer = null;_this2.send(_Events.API.ALIVE); | ||
$(_this4).aliveTimer = null;_this4.send(_Events.API.ALIVE); | ||
}, this.aliveDelay); | ||
@@ -207,0 +221,0 @@ }), _defineProperty(_HANDLERS, _Events.API.SUCCESS, function (data) { |
@@ -1,9 +0,17 @@ | ||
var gulp = require( "gulp" ), | ||
babel = require( "gulp-babel" ); | ||
var gulp = require( "gulp" ), | ||
babel = require( "gulp-babel" ), | ||
src = "./src/**/*.js", | ||
dst = "./dst"; | ||
gulp.task( "build", function(){ | ||
return gulp.src( "./src/**/*.js" ) | ||
return gulp.src( src ) | ||
.pipe( babel() ) | ||
.pipe( gulp.dest( "./dst" ) ); | ||
.pipe( gulp.dest( dst ) ); | ||
}); | ||
gulp.task( "watch", function(){ | ||
return gulp.watch( src, [ "build" ] ) | ||
}); | ||
gulp.task( "default", [ "build", "watch" ] ); |
{ | ||
"name": "apiway", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Client side for Apiway framework", | ||
@@ -11,5 +11,8 @@ "main": "./dst/Apiway.js", | ||
"scripts": { | ||
"start": "gulp", | ||
"build": "gulp build" | ||
}, | ||
"author": "Denis Churbanov", | ||
"author": { | ||
"name": "Denis Churbanov" | ||
}, | ||
"license": "MIT", | ||
@@ -24,3 +27,12 @@ "devDependencies": { | ||
"native-promise-only": "^0.8.1" | ||
} | ||
}, | ||
"gitHead": "6b8ca1065c6d99279136a2cbb667eef99a32fdd4", | ||
"bugs": { | ||
"url": "https://github.com/4urbanoff/js.apiway/issues" | ||
}, | ||
"readme": "ERROR: No README data found!", | ||
"homepage": "https://github.com/4urbanoff/js.apiway#readme", | ||
"_id": "apiway@0.0.4", | ||
"_shasum": "037f5400698548ae16390c7de159eadeb75e5287", | ||
"_from": "apiway@>0.0.2" | ||
} |
@@ -85,7 +85,8 @@ import Promise from "native-promise-only"; | ||
dispatch: function( e ){ | ||
console.log(this); | ||
$( this ).dispatcher = new WebSocket( this.address ); | ||
$( this ).dispatcher.onopen = $( this ).onOpen; | ||
$( this ).dispatcher.onclose = $( this ).onClose; | ||
$( this ).dispatcher.onerror = $( this ).onError; | ||
$( this ).dispatcher.onmessage = $( this ).onMessage; | ||
$( this ).dispatcher.onopen = ( e )=> $( this ).onOpen( e ); | ||
$( this ).dispatcher.onclose = ( e )=> $( this ).onClose( e ); | ||
$( this ).dispatcher.onerror = ( e )=> $( this ).onError( e ); | ||
$( this ).dispatcher.onmessage = ( e )=> $( this ).onMessage( e ); | ||
}, | ||
@@ -99,6 +100,3 @@ | ||
if( beforeReadyPromise instanceof Promise ){ | ||
beforeReadyPromise.then( | ||
( e )=>{ this.trigger( API.READY, e ) }, | ||
( e )=>{ this.trigger( API.UNREADY, e ) } | ||
); | ||
beforeReadyPromise.then( ( e )=> this.trigger( API.READY, e ), ( e )=> this.trigger( API.UNREADY, e ) ); | ||
}else console.warn( `BeforeReadyPromise must be return instance of Promise` ); | ||
@@ -114,3 +112,3 @@ }, | ||
console.warn( `Api disconnected from "${ this.address }"` ); | ||
setTimeout( $( this ).dispatch, $( this ).reconnectDelay * 100 ); | ||
setTimeout( ()=> $( this ).dispatch(), $( this ).reconnectDelay * 100 ); | ||
$( this ).reconnectDelay += 1; | ||
@@ -117,0 +115,0 @@ this.trigger( API.DISCONNECT, e ); |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
29510
689
1
1