• Swedes

    1. Best way to migrate this to async await and remove callback?
    exports.filterComposerFormatting = function(payload, callback) {
      payload.options.push({
        className: 'add-movie-source fa fa-video-camera',
        name: 'add_movie_source',
        title: 'Add movie source',
      });
      payload.options.push({
        className: 'add-movie-review fa fa-video-camera',
        name: 'add_movie_review',
        title: 'Add movie review',
      });
      payload.options.push({
        className: 'add-game-source fa fa-gamepad',
        name: 'add_game_source',
        title: 'Add game source',
      });
      payload.options.push({
        className: 'add-game-review fa fa-gamepad',
        name: 'add_game_review',
        title: 'Add game review',
      });
      callback(null, payload);
    };
    
    1. Is there any nice way to include a client.js file only if the composer is started or open? Now i use scripts in plugin.json and the client.js will allway be included.

  • @jenkler

    exports.filterComposerFormatting = async function(payload, callback) {
      payload.options.push({
        className: 'add-movie-source fa fa-video-camera',
        name: 'add_movie_source',
        title: 'Add movie source',
      });
      payload.options.push({
        className: 'add-movie-review fa fa-video-camera',
        name: 'add_movie_review',
        title: 'Add movie review',
      });
      payload.options.push({
        className: 'add-game-source fa fa-gamepad',
        name: 'add_game_source',
        title: 'Add game source',
      });
      payload.options.push({
        className: 'add-game-review fa fa-gamepad',
        name: 'add_game_review',
        title: 'Add game review',
      });
      return payload;
    };
    
    1. There is no way to do that - you need to have a client.js in the scripts section of your plugin.json.
      What problem you're trying to solve? 🤔

    If you want to catch the activate/minimize/discard events - you can listen to these events:

    • action:composer.discard (link);
    • action:composer.minimize (link);
    • action:composer.activate (link).
  • Global Moderator Plugin & Theme Dev

    @antosik there actually is a way: you can define the stuff you want imported on composer launch as a requirejs module and require it in a script that does get included in the bundle.

  • NodeBB

    The "modules" field in plugin.json can be used to defined requirejs module that are not bundled into the initial payload.

  • Swedes

    I fixed it this way 😉

    exports.filterComposerFormatting = async (data) => {
      data.options.push({
        className: 'add-movie-source fa fa-video-camera',
        name: 'add_movie_source',
        title: 'Add movie source'
      },
      {
        className: 'add-movie-review fa fa-video-camera',
        name: 'add_movie_review',
        title: 'Add movie review'
      },
      {
        className: 'add-game-source fa fa-gamepad',
        name: 'add_game_source',
        title: 'Add game source'
      },
      {
        className: 'add-game-review fa fa-gamepad',
        name: 'add_game_review',
        title: 'Add game review'
      });
      return data;
    };
    

    @baris any example for a noob like me? I just want to load client.js when composer is active due to that it only is needed when working it the composer 🙂

Suggested Topics

  • 12
  • 2
  • 12
  • 4
  • 1
| |