English 中文(简体)
授予模块以装载其他模块
原标题:Grant authority to a module to load other modules

我想将工厂模式纳入我的模块。 我有一个模块:serviceFactory.js

exports.createService = function(serviceName, paramObj){
  return require( Services/ +serviceName).Service.new(paramObj);
};

该模块应当按其名称要求其他模块(服务),并树立一个榜样。 www.un.org/Depts/DGACM/index_french.htm

const Base = require( base ).Base;

exports.Service = Base.extend({
    getName: function(){
        return this.name;
    },
    invoke: function(){
        //do something
    },
});

所有其他服务机构都提供基地服务。 我在“校准”的子“服务”中收集所有服务。 我现在使用<代码>createservice 我的工厂方法,像“摩迪莱:服务行业......无权装载服务”。

是否有办法授予<条码>服务标准。 是否有权装载我的服务,或者是否还有其他办法实现我的目标?

最佳回答

在加薪时,加上SDK就解决了所有要求,但这种加薪不会在运行时间发生。 我猜测,这项工作主要是出于业绩原因(一些地点可以装上摩托车,在延长时间可能很慢时,可以搜索这些地点),但也有安全方面——即使一个模块被破坏(自动操作从网页上下载的代码),它仍无法装上任何额外的模块,特别是<编码><>chrome模块。 但最终结果是:你无法动态地决定你想要使用哪些单元,你只能装上你在源代码中明确要求的单元。

围绕您的工作,将增加一项从未被称作但具有一切必要的<条码>要求(<>/代码>)的职能,以确保SDK解决这些职能:

function dummy()
{
  require("Services/ServiceFoo");
  require("Services/ServiceBar");
  ...
}

将这一职能列入<条码>服务器.js,将确保<条码>createservice()功能要求这些模块。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签