本文整理汇总了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))
}
示例2: setIsolatedWorldContentSecurityPolicy
setIsolatedWorldContentSecurityPolicy (worldId: number, csp: string) {
deprecate.warn('webFrame.setIsolatedWorldContentSecurityPolicy', 'webFrame.setIsolatedWorldInfo')
binding.setIsolatedWorldInfo(this.context, worldId, {
securityOrigin: window.location.origin,
csp
})
}
示例3: setIsolatedWorldHumanReadableName
setIsolatedWorldHumanReadableName (worldId: number, name: string) {
deprecate.warn('webFrame.setIsolatedWorldHumanReadableName', 'webFrame.setIsolatedWorldInfo')
binding.setIsolatedWorldInfo(this.context, worldId, { name })
}
示例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 })
}
示例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