Add FakeWhisperAPI for serverless development
When included after api.js, fake_api.js inits a FakeWhisperAPI. FakeWhisperAPI inherits the methods of API, overrides a few, and then usurps its place as the one true API. Single device mode successfully "registers" against FakeAPI. Sadly, multidevice mode has a recursive loop somewhere that makes the callstack asplode.pull/749/head
parent
6934ba0b92
commit
fe1b5435aa
@ -0,0 +1,27 @@
|
|||||||
|
var FakeWhisperAPI = function() {
|
||||||
|
|
||||||
|
this.doAjax = function(param) {
|
||||||
|
if (param.success_callback) {
|
||||||
|
setTimeout(param.success_callback, 100, param.response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getKeysForNumber = function(number, success_callback, error_callback) {
|
||||||
|
this.doAjax({ success_callback: success_callback,
|
||||||
|
response : [{ identityKey: 1,
|
||||||
|
deviceId : 1,
|
||||||
|
publicKey : 1,
|
||||||
|
keyId : 1 }]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sendMessages = function(jsonData, success_callback, error_callback) {
|
||||||
|
this.doAjax({ success_callback: success_callback,
|
||||||
|
response : { missingDeviceIds: [] }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
FakeWhisperAPI.prototype = API;
|
||||||
|
API = new FakeWhisperAPI();
|
||||||
|
|
Loading…
Reference in New Issue