我正在尝试为execute
不同语言的程序构建服务node
并提供输出.到目前为止,我正在使用child_process
's' spawn
来生成命令.
let p = spawn('python',[sourceFilePath]);
Run Code Online (Sandbox Code Playgroud)
有没有办法让我可以限制child_process
它对我的系统的访问权限network
,以便它无法访问file system
,等等?
我正在尝试扩展 URL 类并添加一个属性来自定义它。但它不起作用。
let { URL } = require('url');
class MyURL extends URL {
constructor(url, base) {
super(url, base);
this.base = base;
}
}
let ur = new MyURL('abc.html','http://www.example.com/about')
console.log(ur);
Run Code Online (Sandbox Code Playgroud)
它记录
MyURL { href: ' http://www.example.com/abc.html ', origin: ' http://www.example.com ', 协议: 'http:', 用户名: '', 密码: '' ,主机:'www.example.com',主机名:'www.example.com',端口:'',路径名:'/abc.html',搜索:'',searchParams:URLSearchParams {},哈希:'' }
请注意,它没有基本属性。为什么会发生这种情况?
如何通过扩展使其具有构造函数中提供的基础属性基础URL
?
我是Angular的新手,这个问题可能听起来很愚蠢.请多多包涵.
我定义了我的ngOnInit
喜欢:
ngOnInit() {
this.rowData = this.studentService.getStudents();//Make http calls to populate data
}
Run Code Online (Sandbox Code Playgroud)
在一个事件中,我再次调用ngOnInit,因为我需要重新加载数据:
onSomeEvent(){
this.ngOnInit();
}
Run Code Online (Sandbox Code Playgroud)
这个可以吗?或者我应该写一行来再次调用http,如果这ngOnInit()
是一个昂贵的方法.