@ekidpro/bridge
Advanced tools
Comparing version 1.0.7 to 1.0.8
import { Listener } from './listener'; | ||
import { Emitter } from './emitter/emitter'; | ||
declare global { | ||
@@ -15,2 +16,3 @@ interface Window { | ||
}; | ||
emitter?: Emitter; | ||
deeplink?: string; | ||
@@ -22,2 +24,3 @@ }; | ||
} | ||
export { EmitterEvents } from './emitter/emitter-events'; | ||
export { Listener, NetworkChange } from './listener'; | ||
@@ -24,0 +27,0 @@ export { controller } from './controller'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var emitter_events_1 = require("./emitter/emitter-events"); | ||
Object.defineProperty(exports, "EmitterEvents", { enumerable: true, get: function () { return emitter_events_1.EmitterEvents; } }); | ||
var listener_1 = require("./listener"); | ||
@@ -4,0 +6,0 @@ Object.defineProperty(exports, "Listener", { enumerable: true, get: function () { return listener_1.Listener; } }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Listener = void 0; | ||
const emitter_1 = require("./emitter/emitter"); | ||
class Listener { | ||
@@ -8,2 +9,5 @@ constructor() { | ||
window.ekp.listener = undefined; | ||
if (window.ekp.emitter) { | ||
window.ekp.emitter.destroy(); | ||
} | ||
}; | ||
@@ -18,4 +22,5 @@ } | ||
window.ekp.listener = new Listener(); | ||
window.ekp.emitter = new emitter_1.Emitter(); | ||
return window.ekp.listener; | ||
}; | ||
//# sourceMappingURL=listener.js.map |
{ | ||
"name": "@ekidpro/bridge", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Bridge between ekidpro app with website", | ||
@@ -47,2 +47,2 @@ "homepage": "https://github.com/ekidpro-vn/bridge", | ||
} | ||
} | ||
} |
@@ -162,1 +162,21 @@ ![ekidpro](./documents/image.png 'eKidPro Logo') | ||
* // TODO: getUserInfo() | ||
4. Lắng nghe thay đổi từ trong app | ||
```js | ||
window.ekp.emitter; | ||
``` | ||
Đây là object Emitter dành cho việc giao tiếp. Nếu như khó trong việc quản lý state, việc thay đổi emitter thành object|events khác hoàn toàn khả thi. | ||
First example: | ||
```js | ||
const handler = data => console.log(data); | ||
window.ekp.emitter.add('INSETS_CHANGE', handler); | ||
// Later | ||
// IMPORTANT: do not forget to remove handler | ||
window.ekp.emitter.remove('INSETS_CHANGE', handler); | ||
``` |
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
43702
62
674
182