本文整理汇总了TypeScript中electron.deprecate类的典型用法代码示例。如果您正苦于以下问题:TypeScript deprecate类的具体用法?TypeScript deprecate怎么用?TypeScript deprecate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了deprecate类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
powerMonitor.querySystemIdleTime = function (callback: Function) {
deprecate.warn('powerMonitor.querySystemIdleTime', 'powerMonitor.getSystemIdleTime')
if (typeof callback !== 'function') throw new Error('Must pass function as an argument')
const idleTime = this.getSystemIdleTime()
process.nextTick(() => callback(idleTime))
}
开发者ID:doridoridoriand,项目名称:electron,代码行数:7,代码来源:power-monitor.ts
示例2: setIsolatedWorldContentSecurityPolicy
setIsolatedWorldContentSecurityPolicy (worldId: number, csp: string) {
deprecate.warn('webFrame.setIsolatedWorldContentSecurityPolicy', 'webFrame.setIsolatedWorldInfo')
binding.setIsolatedWorldInfo(this.context, worldId, {
securityOrigin: window.location.origin,
csp
})
}
开发者ID:doridoridoriand,项目名称:electron,代码行数:7,代码来源:web-frame.ts
示例3: setIsolatedWorldHumanReadableName
setIsolatedWorldHumanReadableName (worldId: number, name: string) {
deprecate.warn('webFrame.setIsolatedWorldHumanReadableName', 'webFrame.setIsolatedWorldInfo')
binding.setIsolatedWorldInfo(this.context, worldId, { name })
}
开发者ID:doridoridoriand,项目名称:electron,代码行数:4,代码来源:web-frame.ts
示例4: setIsolatedWorldSecurityOrigin
// Deprecations
// TODO(nitsakh): Remove in 6.0
setIsolatedWorldSecurityOrigin (worldId: number, securityOrigin: string) {
deprecate.warn('webFrame.setIsolatedWorldSecurityOrigin', 'webFrame.setIsolatedWorldInfo')
binding.setIsolatedWorldInfo(this.context, worldId, { securityOrigin })
}
开发者ID:doridoridoriand,项目名称:electron,代码行数:6,代码来源:web-frame.ts
示例5: function
// Populate the methods.
for (const name in binding) {
if (!name.startsWith('_')) { // some methods are manually populated above
// TODO(felixrieseberg): Once we can type web_frame natives, we could
// use a neat `keyof` here
(WebFrame as any).prototype[name] = function (...args: Array<any>) {
return binding[name](this.context, ...args)
}
}
}
// Helper to return WebFrame or null depending on context.
// TODO(zcbenz): Consider returning same WebFrame for the same frame.
function getWebFrame (context: Window) {
return context ? new WebFrame(context) : null
}
const promisifiedMethods = new Set<string>([
'executeJavaScript',
'executeJavaScriptInIsolatedWorld'
])
for (const method of promisifiedMethods) {
(WebFrame as any).prototype[method] = deprecate.promisify((WebFrame as any).prototype[method])
}
const _webFrame = new WebFrame(window)
export default _webFrame
开发者ID:doridoridoriand,项目名称:electron,代码行数:29,代码来源:web-frame.ts
注:本文中的electron.deprecate类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论