Zone
12/2/2017 - 7:21 AM

[JS] private function test example

[JS] private function test example

grunt.initConfig({
  strip_code: {
    options: {
        blocks: [{start_block: "/*FK*/", end_block: "/*FK2*/"}]
    },
    your_target: {src: '1.ts', dest:'1_stripped.ts'}
  }
})

grunt.loadNpmTasks('grunt-strip-code');

grunt.registerTask("test", [
  "concat",
  "jshint",
  "jasmine"
])
grunt.registerTask("deploy", [
  "concat",
  "strip_code",
  "jshint",
  "uglify"
])
var myModule = (function() {

  function foo() {
    // private function `foo` inside closure
    return "foo"
  }

  var api = {
    bar: function() {
      // public function `bar` returned from closure
      return "bar"
    }
  }

  /*FK*/
  api._foo = foo
  /*FK2*/

  return api
}())