• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript app_events.emit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中app/core/app_events.emit函数的典型用法代码示例。如果您正苦于以下问题:TypeScript emit函数的具体用法?TypeScript emit怎么用?TypeScript emit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了emit函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: RegExp

    $scope.isValid = () => {
      if (!$scope.ctrl.form.$valid) {
        return false;
      }

      if (!$scope.current.name.match(/^\w+$/)) {
        appEvents.emit('alert-warning', ['Validation', 'Only word and digit characters are allowed in variable names']);
        return false;
      }

      const sameName = _.find($scope.variables, { name: $scope.current.name });
      if (sameName && sameName !== $scope.current) {
        appEvents.emit('alert-warning', ['Validation', 'Variable with the same name already exists']);
        return false;
      }

      if (
        $scope.current.type === 'query' &&
        _.isString($scope.current.query) &&
        $scope.current.query.match(new RegExp('\\$' + $scope.current.name + '(/| |$)'))
      ) {
        appEvents.emit('alert-warning', [
          'Validation',
          'Query cannot contain a reference to itself. Variable: $' + $scope.current.name,
        ]);
        return false;
      }

      return true;
    };
开发者ID:CorpGlory,项目名称:grafana,代码行数:30,代码来源:editor_ctrl.ts


示例2: parseInt

    $scope.init = () => {
      contextSrv.sidemenu = false;
      appEvents.emit('toggle-sidemenu-hidden');

      const params = $location.search();
      panelId = parseInt(params.panelId, 10);

      $scope.onAppEvent('dashboard-initialized', $scope.initPanelScope);

      // if no uid, redirect to new route based on slug
      if (!($routeParams.type === 'script' || $routeParams.type === 'snapshot') && !$routeParams.uid) {
        backendSrv.getDashboardBySlug($routeParams.slug).then(res => {
          if (res) {
            const url = locationUtil.stripBaseFromUrl(res.meta.url.replace('/d/', '/d-solo/'));
            $location.path(url).replace();
          }
        });
        return;
      }

      dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug, $routeParams.uid).then(result => {
        result.meta.soloMode = true;
        $scope.initDashboard(result, $scope);
      });
    };
开发者ID:ArcticSnowman,项目名称:grafana,代码行数:25,代码来源:solo_panel_ctrl.ts


示例3: switch

      appEvents.on('toggle-kiosk-mode', options => {
        const search = $location.search();

        if (options && options.exit) {
          search.kiosk = 1;
        }

        switch (search.kiosk) {
          case 'tv': {
            search.kiosk = 1;
            appEvents.emit('alert-success', ['Press ESC to exit Kiosk mode']);
            break;
          }
          case 1:
          case true: {
            delete search.kiosk;
            break;
          }
          default: {
            search.kiosk = 'tv';
          }
        }

        $location.search(search);
        setViewModeBodyClass(body, search.kiosk, sidemenuOpen);
      });
开发者ID:gzq0616,项目名称:grafana,代码行数:26,代码来源:grafana_app.ts


示例4: switch

      appEvents.on('toggle-kiosk-mode', (options: { exit?: boolean }) => {
        const search: { kiosk?: KioskUrlValue } = $location.search();

        if (options && options.exit) {
          search.kiosk = '1';
        }

        switch (search.kiosk) {
          case 'tv': {
            search.kiosk = true;
            appEvents.emit('alert-success', ['Press ESC to exit Kiosk mode']);
            break;
          }
          case '1':
          case true: {
            delete search.kiosk;
            break;
          }
          default: {
            search.kiosk = 'tv';
          }
        }

        $timeout(() => $location.search(search));
        setViewModeBodyClass(body, search.kiosk);
      });
开发者ID:grafana,项目名称:grafana,代码行数:26,代码来源:GrafanaCtrl.ts


示例5: setViewModeBodyClass

      scope.$on('$routeChangeSuccess', (evt, data) => {
        if (pageClass) {
          body.removeClass(pageClass);
        }

        if (data.$$route) {
          pageClass = data.$$route.pageClass;
          if (pageClass) {
            body.addClass(pageClass);
          }
        }

        // clear body class sidemenu states
        body.removeClass('sidemenu-open--xs');

        $('#tooltip, .tooltip').remove();

        // check for kiosk url param
        setViewModeBodyClass(body, data.params.kiosk);

        // close all drops
        for (const drop of Drop.drops) {
          drop.destroy();
        }

        appEvents.emit('hide-dash-search');
      });
开发者ID:grafana,项目名称:grafana,代码行数:27,代码来源:GrafanaCtrl.ts


示例6: Promise

 return new Promise((resolve, reject) => {
   // send event to import list component
   appEvents.emit('dashboard-list-import-all', {
     resolve: resolve,
     reject: reject
   });
 });
开发者ID:ColonelHou,项目名称:grafana,代码行数:7,代码来源:plugin_edit_ctrl.ts


示例7: showConfirmModal

  showConfirmModal(payload) {
    var scope = this.$rootScope.$new();

    scope.onConfirm = function() {
      payload.onConfirm();
      scope.dismiss();
    };

    scope.updateConfirmText = function(value) {
      scope.confirmTextValid = payload.confirmText.toLowerCase() === value.toLowerCase();
    };

    scope.title = payload.title;
    scope.text = payload.text;
    scope.text2 = payload.text2;
    scope.confirmText = payload.confirmText;

    scope.onConfirm = payload.onConfirm;
    scope.onAltAction = payload.onAltAction;
    scope.altActionText = payload.altActionText;
    scope.icon = payload.icon || 'fa-check';
    scope.yesText = payload.yesText || 'Yes';
    scope.noText = payload.noText || 'Cancel';
    scope.confirmTextValid = scope.confirmText ? false : true;

    appEvents.emit('show-modal', {
      src: 'public/app/partials/confirm_modal.html',
      scope: scope,
      modalClass: 'confirm-modal',
    });
  }
开发者ID:InvariantIO,项目名称:grafana,代码行数:31,代码来源:util_srv.ts


示例8: getDefaultProject

 async getDefaultProject() {
   try {
     const projects = await this.getProjects();
     if (projects && projects.length > 0) {
       const test = projects.filter(p => p.id === this.projectName)[0];
       return test;
     } else {
       throw new Error('No projects found');
     }
   } catch (error) {
     let message = 'Projects cannot be fetched: ';
     message += error.statusText ? error.statusText + ': ' : '';
     if (error && error.data && error.data.error && error.data.error.message) {
       if (error.data.error.code === 403) {
         message += `
           A list of projects could not be fetched from the Google Cloud Resource Manager API.
           You might need to enable it first:
           https://console.developers.google.com/apis/library/cloudresourcemanager.googleapis.com`;
       } else {
         message += error.data.error.code + '. ' + error.data.error.message;
       }
     } else {
       message += 'Cannot connect to Stackdriver API';
     }
     appEvents.emit('ds-request-error', message);
   }
 }
开发者ID:ArcticSnowman,项目名称:grafana,代码行数:27,代码来源:datasource.ts


示例9: function

      scope.$on('$routeChangeSuccess', function(evt, data) {
        if (pageClass) {
          body.removeClass(pageClass);
        }

        if (data.$$route) {
          pageClass = data.$$route.pageClass;
          if (pageClass) {
            body.addClass(pageClass);
          }
        }

        // clear body class sidemenu states
        body.removeClass('sidemenu-open--xs');

        $('#tooltip, .tooltip').remove();

        // check for kiosk url param
        if (data.params.kiosk) {
          appEvents.emit('toggle-kiosk-mode');
        }

        // close all drops
        for (let drop of Drop.drops) {
          drop.destroy();
        }
      });
开发者ID:InvariantIO,项目名称:grafana,代码行数:27,代码来源:grafana_app.ts


示例10: function

      scope.$on('$routeChangeSuccess', function(evt, data) {
        if (pageClass) {
          body.removeClass(pageClass);
        }

        if (data.$$route) {
          pageClass = data.$$route.pageClass;
          if (pageClass) {
            body.addClass(pageClass);
          }
        }

        // clear body class sidemenu states
        body.removeClass('sidemenu-open--xs');

        $('#tooltip, .tooltip').remove();

        // check for kiosk url param
        if (data.params.kiosk) {
          appEvents.emit('toggle-kiosk-mode');
        }

        // check for 'inactive' url param for clean looks like kiosk, but with title
        if (data.params.inactive) {
          body.addClass('user-activity-low');

          // for some reason, with this class it looks cleanest
          body.addClass('sidemenu-open');
        }

        // close all drops
        for (let drop of Drop.drops) {
          drop.destroy();
        }
      });
开发者ID:kwarunek,项目名称:grafana,代码行数:35,代码来源:grafana_app.ts



注:本文中的app/core/app_events.emit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript app_events.on函数代码示例发布时间:2022-05-25
下一篇:
TypeScript location.updateLocation函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap