code: function draw (type) { // TODO: use type
          if (cache !== null) {
              return new Promise((resolve) => {
                  resolve(cache);
              });
          }
          return new Promise((resolve, reject) => {
              const images = [];
  
              // Wait for resourse loading
              onLoadPromise.then(() => {
                  RED.nodes.import(flow);
                  const workspaceIds = Object.keys(RED.workspaces.tabs());
                  drawWorkspacesWithIds(workspaceIds).catch((err) => { console.error(err); });
              });
              
              function drawWorkspacesWithIds (ids) {
                  const id = ids.pop();
                  if (!id) {
                      return;
                  } else {
                      RED.workspaces.show(id);
                      const el = RED.view.redraw(true);
                      const unmute = mute();
                      return svgSaver.svgAsDataUri(el).then(function (uri) {
                          unmute();
                          images.push(uri);
                          const promise = drawWorkspacesWithIds(ids);
                          if (promise) {
                              promise.catch((err) => { reject(err); });
                          } else {
                              resolve(images);
                          }
                      });
                  }
              }
          }).then((results) => cache = results);
      }
docs: eslint-disable-next-line