slack-disable-wysiwyg-bookmarklet icon indicating copy to clipboard operation
slack-disable-wysiwyg-bookmarklet copied to clipboard

Does not work out of the box for nativifier

Open keymon opened this issue 5 years ago • 0 comments

I am using this with nativifier: https://github.com/jiahaog/nativefier/blob/master/docs/api.md#inject but it runs "too" early and slackDebug is not yet ready. The app is created with:

nativefier "https://app.slack.com" -m --name slack --disable-context-menu --disable-dev-tools  --internal-urls '(.*\.slack\.com)|(slack\.com)|(confluent\.okta\.com)' --inject /tmp/no_wysiwyg.js  

to solve it, I added a timeout to call the function later after 10s. Not elegant but works. I don't know too much about js to make it better.

It looks like this

(() => {
    setTimeout( function(){
        const workspaceIds = slackDebug.clientStore.workspaces.getAllWorkspaces();
        for (const workspaceId of workspaceIds) {
            const { redux } = slackDebug[workspaceId];
            const {
                wysiwyg_composer,
                wysiwyg_composer_ios,
                wysiwyg_composer_webapp,
                ...payload
            } = redux.getState().experiments;
            redux.dispatch({
                type: '[19] Bulk add experiment assignments to redux',
                payload
            });
        }
    }, 10000);
})();

keymon avatar Nov 29 '19 12:11 keymon