當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript newrelic.setControllerName函數代碼示例

本文整理匯總了TypeScript中newrelic.setControllerName函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setControllerName函數的具體用法?TypeScript setControllerName怎麽用?TypeScript setControllerName使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了setControllerName函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

  deactivateCoupon: function (req, res) {
    NewRelic.setControllerName('ProfileController.deactivateCoupon');
    var addonId = req.param('id');
    var code:String = req.param('code');

    Addon.findOne(addonId)
      .then(function (addon:Addon) {
        if (addon === undefined) {
          res.notFound();
        } else if (!addon.canModify(req.user)) {
          res.forbidden();
        } else if (!addon.couponExists(code)) {
          req.flash('error', "That coupon does not exist.");
          res.redirect('/profile/addons/' + addonId);
        } else if (!addon.isValidCoupon(code)) {
          req.flash('error', "That coupon has already expired.");
          res.redirect('/profile/addons/' + addonId);
        } else {
          return addon.deactivateCoupon(code);
        }
      })
      .then(function () {
        req.flash('success', "Coupon '" + code + "' has been deactivated.");
        res.redirect('/profile/addons/' + addonId)
      });
  },
開發者ID:ModMountain,項目名稱:web-old,代碼行數:26,代碼來源:ProfileController.ts

示例2: function

  validateCoupon: function (req, res) {
    NewRelic.setControllerName('AddonsController.validateCoupon');
    if (!req.isSocket) {
      req.flash('error', 'Only sockets may validate coupons');
      res.redirect('/')
    }

    var addonId = req.param('id');
    var couponCode = req.param('couponCode');

    // We don't need to do a full populate because coupons are stored directly on the addon
    Addon.findOne(addonId)
      .then(function (addon:Addon) {
        if (addon === undefined) {
          req.socket.emit('notification', {
            type: 'error',
            msg: 'That addon does not exist'
          });
        } else {
          req.socket.emit('couponValidated', addon.getCoupon(couponCode));
        }
      }).catch(function (err) {
        PrettyError(err, "Something went wrong during Addon.findOne inside AddonsController.validateCoupon:")
      });
  },
開發者ID:ModMountain,項目名稱:web-old,代碼行數:25,代碼來源:AddonsController.ts

示例3: function

	termsOfService: function (req, res) {
		NewRelic.setControllerName('StaticController.termsOfService');
		res.view({
			title: 'Terms of Service',
			activeTab: 'extra',
			breadcrumbs: true
		});
	},
開發者ID:ModMountain,項目名稱:web-old,代碼行數:8,代碼來源:StaticController.ts


注:本文中的newrelic.setControllerName函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。