Skip to content

IIFE: Wrap #83

@kocur4d

Description

@kocur4d

IIFE: Wrap AngularJS components in an Immediately Invoked Function Expression (IIFE).

CoffeeScript automatically wraps every file in to IIFE, this suggestion is not necessary while working with coffeescript

campaign_service.js.coffee

CampaignService = ->
  {}

angular
  .module 'dashboard'
  .factory 'CampaignService', [
    CampaignService
  ]

Will become:

campaign_service.js

(function() {
  var CampaignService;

  CampaignService = function() {
    return {};
  };

  angular.module('dashboard').factory('CampaignService', [CampaignService]);

}).call(this);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions