Adding function to namespace/module from another file

谁都会走 提交于 2019-12-24 14:31:48

问题


I ma writing custom editor for slickgrid.

slick.editors.js

/***
 * Contains basic SlickGrid editors.
 * @module Editors
 * @namespace Slick
 */

(function ($) {
  // register namespace
  $.extend(true, window, {
    "Slick": {
      "Editors": {
        "Text": TextEditor,
        "Integer": IntegerEditor,
        "Float": FloatEditor,
        "Date": DateEditor,
        "YesNoSelect": YesNoSelectEditor,
        "Checkbox": CheckboxEditor,
        "PercentComplete": PercentCompleteEditor,
        "LongText": LongTextEditor
      }
    }
  });

  function TextEditor(args) {
    var $input;
    var defaultValue;
    var scope = this;
.
.
.
})(jQuery);

The function can be called under namespace import { Editors } from 'slickgrid-es6'; Editors.TextEditor()

Now I want to add here myTextEditor(args) function, but not altering slick.editors.js file.

in myText.js the function is written like this below

var myTextEditor = function MyTextEditor(args) {
  var $input;
  var defaultValue;
  var scope = this;

then I want to add this under Slick namespace in Editors module. so that I can call Editors.myTextEditor()

Is it possible??

来源:https://stackoverflow.com/questions/53293466/adding-function-to-namespace-module-from-another-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!