當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript electron.deprecate類代碼示例

本文整理匯總了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;未經允許,請勿轉載。