How to use moduleraid - 4 common examples

To help you get started, we’ve selected a few moduleraid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pedroslopez / whatsapp-web.js / src / Client.js View on Github external
}

        } else {
            // Wait for QR Code
            const QR_CANVAS_SELECTOR = 'canvas';
            await page.waitForSelector(QR_CANVAS_SELECTOR);
            const qrImgData = await page.$eval(QR_CANVAS_SELECTOR, canvas => [].slice.call(canvas.getContext('2d').getImageData(0,0,264,264).data));
            const qr = jsQR(qrImgData, 264, 264).data;
            
            this.emit(Events.QR_RECEIVED, qr);

            // Wait for code scan
            await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 });
        }

        await page.evaluate(ExposeStore, moduleRaid.toString());

        // Get session tokens
        const localStorage = JSON.parse(await page.evaluate(() => {
            return JSON.stringify(window.localStorage);
        }));

        const session = {
            WABrowserId: localStorage.WABrowserId,
            WASecretBundle: localStorage.WASecretBundle,
            WAToken1: localStorage.WAToken1,
            WAToken2: localStorage.WAToken2
        }

        this.emit(Events.AUTHENTICATED, session);

        // Check Store Injection
github eramdam / BetterTweetDeck / src / js / inject.js View on Github external
import FileSaver from 'file-saver';
import { debounce, unescape } from 'lodash';
import moduleRaid from 'moduleraid';

import AdvancedMuteEngine from './util/ame';
import * as GIFS from './util/gifs';
import { keepHashtags } from './util/keepHashtags';
import Log from './util/logger';
import { giphyBlock, giphySearch } from './util/templates';
import { onComposerShown } from './util/tweetdeckUtils';
import UsernamesTemplates from './util/username_templates';

const SETTINGS = JSON.parse(document.querySelector('[data-btd-settings]').dataset.btdSettings);
let mR;
try {
  mR = moduleRaid();
} catch (e) {
  //
}

window.$ = mR && mR.findFunction('jQuery') && mR.findFunction('jquery:')[0];

const OGGetHogan = mR.findModule('getHogan')[0].getHogan;

// Thanks to @pixeldesu for the sick moduleRaid trick
// As of October 12th 2019 TweetDeck started putting mustache templates into webpack modules
// meaning modifying them in place in TD.mustaches isn't working anymore, this proxies the calls to the template rendering into TD.mustaches for compatibility.
// This might break the day TD.mustaches completely disappears but...let's hope it's not too soon.
mR.findModule('getHogan')[0].getHogan = function getHogan(...args) {
  const [template] = args;
  const fqtn = `${template}.mustache`;
github eramdam / BetterTweetDeck / src / inject.ts View on Github external
import {BTDSettingsAttribute} from './types/betterTweetDeck/btdCommonTypes';
import {BTDMessageOriginsEnum, BTDMessages} from './types/betterTweetDeck/btdMessageTypes';
import {BTDSettings} from './types/betterTweetDeck/btdSettingsTypes';
import {TweetDeckObject} from './types/tweetdeckTypes';
import {maybeRevertToLegacyReplies} from './features/revertToLegacyReplies';

// Declare typings on the window
declare global {
  interface Window {
    TD: unknown;
  }
}

let mR;
try {
  mR = moduleRaid();
} catch (e) {
  //
}

const TweetDeck = window.TD as TweetDeckObject;
// Grab TweetDeck's jQuery from webpack
const $: JQueryStatic | undefined =
  mR && mR.findFunction('jQuery') && mR.findFunction('jquery:')[0];

(async () => {
  if (!isObject(TweetDeck)) {
    return;
  }

  const settings = getBTDSettings();
github eramdam / BetterTweetDeck / src / js / inject.ts View on Github external
msgToContent,
  onBTDMessage,
  OpenFullscreenPreviewMessage
} from './services/messaging';
import {BTDSettings} from './types';

declare global {
  interface Window {
    TD: any;
    $: any;
  }
}

let mR;
try {
  mR = moduleRaid();
} catch (e) {
  //
}

window.$ = mR && mR.findFunction('jQuery') && mR.findFunction('jquery:')[0];

const Settings: BTDSettings = JSON.parse(document.querySelector('[data-btd-settings]')!.getAttribute('data-btd-settings') || '');

/**
 * Setup different services/modules.
 */
maybeRemoveTcoRedirections(Settings, window.TD);
maybeAddCustomDate(Settings, window.TD);
setupMediaSizeMonitor(Settings, window.TD);

/**

moduleraid

Get modules from webpackJsonp

MIT
Latest version published 12 months ago

Package Health Score

56 / 100
Full package analysis

Popular moduleraid functions