diff --git a/src/js-framework/lib/app/__test__/ctrl.js b/src/js-framework/lib/app/__test__/ctrl.js index 9c5607fbe4..07c7e96d51 100644 --- a/src/js-framework/lib/app/__test__/ctrl.js +++ b/src/js-framework/lib/app/__test__/ctrl.js @@ -126,7 +126,7 @@ describe('the api of app', () => { describe('callback', () => { it('with a simple data', () => { const data = {a: 'b'} - app.callback('1', data, false) + app.callback('1', data, true) expect(spy2.calledOnce).to.be.true expect(spy2.args[0][0]).to.deep.equal(data) expect(app.callbacks[1]).to.be.a('function') @@ -134,12 +134,12 @@ describe('the api of app', () => { it('multiple called', () => { const data = {a: 'b'} - app.callback('1', data, false) + app.callback('1', data, true) expect(spy2.calledTwice).to.be.true expect(spy2.args[0][0]).to.deep.equal(data) expect(app.callbacks[1]).to.be.a('function') - app.callback('1', data, true) + app.callback('1', data, false) expect(spy2.calledThrice).to.be.true expect(spy2.args[0][0]).to.deep.equal(data) expect(app.callbacks[1]).to.be.undefined diff --git a/src/js-framework/lib/app/ctrl.js b/src/js-framework/lib/app/ctrl.js index 9a942a31cf..ed915b46d9 100644 --- a/src/js-framework/lib/app/ctrl.js +++ b/src/js-framework/lib/app/ctrl.js @@ -127,13 +127,13 @@ export function fireEvent(ref, type, e, domChanges) { return new Error(`invalid element reference "${ref}"`) } -export function callback(callbackId, data, ifLast) { +export function callback(callbackId, data, ifKeepAlive) { const callback = this.callbacks[callbackId] if (typeof callback === 'function') { callback(data) // data is already a object, @see: lib/framework.js - if (typeof ifLast === 'undefined' || ifLast === true) { + if (typeof ifKeepAlive === 'undefined' || ifKeepAlive === false) { this.callbacks[callbackId] = undefined }