本文整理匯總了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