network-throttle.plugin.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. var networkThrottle = require("./network-throttle");
  2. const PLUGIN_NAME = "Network Throttle";
  3. /**
  4. * @type {{plugin: Function, plugin:name: string, markup: string}}
  5. */
  6. module.exports = {
  7. /**
  8. * Plugin init
  9. */
  10. "plugin": function (ui, bs) {
  11. ui.throttle = networkThrottle.init(ui, bs);
  12. ui.listen("network-throttle", ui.throttle);
  13. },
  14. /**
  15. * Hooks
  16. */
  17. "hooks": {
  18. "markup": fileContent("/network-throttle.html"),
  19. "client:js": [fileContent("/network-throttle.client.js")],
  20. "templates": [],
  21. "page": {
  22. path: "/network-throttle",
  23. title: PLUGIN_NAME,
  24. template: "network-throttle.html",
  25. controller: "NetworkThrottleController",
  26. order: 5,
  27. icon: "time"
  28. }
  29. },
  30. /**
  31. * Plugin name
  32. */
  33. "plugin:name": PLUGIN_NAME
  34. };
  35. /**
  36. * @param filepath
  37. * @returns {*}
  38. */
  39. function getPath (filepath) {
  40. return require("path").join(__dirname, filepath);
  41. }
  42. /**
  43. * @param filepath
  44. * @returns {*}
  45. */
  46. function fileContent (filepath) {
  47. return require("fs").readFileSync(getPath(filepath));
  48. }