mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
Initial simple client implementation
This commit is contained in:
50
src/util/Injected.js
Normal file
50
src/util/Injected.js
Normal file
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Exposes the internal Store to the WhatsApp Web client
|
||||
*/
|
||||
exports.ExposeStore = () => {
|
||||
setTimeout(function () {
|
||||
function getAllModules() {
|
||||
return new Promise((resolve) => {
|
||||
const id = _.uniqueId("fakeModule_");
|
||||
window["webpackJsonp"](
|
||||
[],
|
||||
{
|
||||
[id]: function (module, exports, __webpack_require__) {
|
||||
resolve(__webpack_require__.c);
|
||||
}
|
||||
},
|
||||
[id]
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
var modules = getAllModules()._value;
|
||||
|
||||
for (var key in modules) {
|
||||
if (modules[key].exports) {
|
||||
if (modules[key].exports.default) {
|
||||
if (modules[key].exports.default.Wap) {
|
||||
store_id = modules[key].id.replace(/"/g, '"');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, 2000);
|
||||
|
||||
function _requireById(id) {
|
||||
return webpackJsonp([], null, [id]);
|
||||
}
|
||||
|
||||
var store_id = 0;
|
||||
|
||||
function init() {
|
||||
window.Store = _requireById(store_id).default;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
init();
|
||||
}, 5000);
|
||||
}
|
||||
Reference in New Issue
Block a user