flipper-client-sdk
Version:
SDK to build Flipper clients for JS based apps
43 lines • 1.16 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.flipper = exports.init = exports.SeaMammalPlugin = void 0;
const webviewImpl_1 = require("./webviewImpl");
class SeaMammalPlugin {
onConnect(connection) {
this.connection = connection;
}
onDisconnect() {
this.connection = null;
}
getId() {
return 'sea-mammals';
}
runInBackground() {
return true;
}
newRow(row) {
var _a;
(_a = this.connection) === null || _a === void 0 ? void 0 : _a.send('newRow', row);
}
}
exports.SeaMammalPlugin = SeaMammalPlugin;
class FlipperManager {
constructor() {
this.flipperClient = webviewImpl_1.newWebviewClient();
this.seaMammalPlugin = new SeaMammalPlugin();
this.flipperClient.addPlugin(this.seaMammalPlugin);
this.flipperClient.start('Example JS App');
}
}
let flipperManager;
function init() {
if (!flipperManager) {
flipperManager = new FlipperManager();
}
}
exports.init = init;
function flipper() {
return flipperManager;
}
exports.flipper = flipper;
//# sourceMappingURL=example.js.map
;