当前位置: 首页 > news >正文

2015做网站前景百度ai人工智能

2015做网站前景,百度ai人工智能,wordpress 返回,做网站如何配置自己的电脑文章目录 渲染进程到主进程(单向)渲染进程到主进程(双向)主进程到渲染进程 (单向,可模拟双向) 渲染进程到主进程(单向) send (render 发送)on &a…

文章目录

  • 渲染进程到主进程(单向)
  • 渲染进程到主进程(双向)
  • 主进程到渲染进程 (单向,可模拟双向)

渲染进程到主进程(单向)

send (render 发送)on (main 监听)

// main.js 主要代码// electron/main includes types for all main process modules.
const { app, ipcMain } =  require("electron/main")
app.whenReady().then(()=>{// 需要在 HTML 文件加载之前监听,保证从渲染器调用之前处理程序能够准备就绪。ipcMain.on('set-title', (event, title) => {const webContents = event.senderconst win = BrowserWindow.fromWebContents(webContents)win.setTitle(title)})createWindow(); // 创建窗口
})
// preload.js // electron/renderer includes types for all renderer process modules.
const { contextBridge, ipcRenderer } = require("electron/renderer")
contextBridge.exposeInMainWorld("electronAPI", ()=>{setTitle: (title) => ipcRenderer.send('set-title',title)
})
// renderer.js// 插入html中的js, 运行于渲染程序中
const setButton = document.getElementById('btn')
const titleInput = document.getElementById('title')
setButton.addEventListener('click', () => {const title = titleInput.valuewindow.electronAPI.setTitle(title)
})

渲染进程到主进程(双向)

invoke(render 发送)handle(main 监听)

const { app, ipcMain, dialog } =  require("electron/main")
app.whenReady().then(()=>{// 需要在 HTML 文件加载之前监听,保证从渲染器调用之前处理程序能够准备就绪。// IPC 通道名称上的 dialog: 前缀对代码没有影响。 它仅用作命名空间以帮助提高代码的可读性。ipcMain.handle('dialog:openFile', async () => {const { canceled, filePaths } = await dialog.showOpenDialog()if(!canceled) return filePaths[0]})createWindow(); // 创建窗口
})
// preload.js // electron/renderer includes types for all renderer process modules.
const { contextBridge, ipcRenderer } = require("electron/renderer")
contextBridge.exposeInMainWorld("electronAPI", ()=>{openFile: () => ipcRenderer.invoke('dialog:openFile')
})
// renderer.js// 插入html中的js, 运行于渲染程序中
const setButton = document.getElementById('btn')
const filePath= document.getElementById('filePath')
setButton.addEventListener('click', async () => {const path= await window.electronAPI.openFile()filePath.innerText= path
})

主进程到渲染进程 (单向,可模拟双向)

send on

// main.jsconst { app, BrowserWindow, Menu, ipcMain } = require('electron/main')
const path = require('node:path')function createWindow () {const mainWindow = new BrowserWindow({webPreferences: {preload: path.join(__dirname, 'preload.js')}})const menu = Menu.buildFromTemplate([{label: app.name,submenu: [{// 使用 webContents.send API 将 IPC 消息从主进程发送到目标渲染器。// 其使用方式与 ipcRenderer.send 相同。click: () => mainWindow.webContents.send('update-counter', 1),label: 'Increment'},{click: () => mainWindow.webContents.send('update-counter', -1),label: 'Decrement'}]}])Menu.setApplicationMenu(menu)mainWindow.loadFile('index.html')
}app.whenReady().then(() => {// 模拟双向通信,接收渲染进程发送的数据,"update-counter" 触发ipcMain.on('counter-value', (_event, value) => {console.log(value) })createWindow()
})
// preload.jsconst { contextBridge, ipcRenderer } = require("electron/renderer")
contextBridge.exposeInMainWorld("electronAPI", {onUpdateCounter: (callback) => ipcRenderer.on("update-counter", (event,value) => callback(value)),sendCount: (value) => ipcRender.send('counter-value', value)
})
// render.js
const count = document.getElementById("count")
window.electronAPI.onUpdateCounter((value)=>{const newValue = Number(count.innerText) + value;count.innerText = newValue.toString();window.electronAPI.sendCount(newValue)
})

文章转载自:
http://dinncooxyphilic.tqpr.cn
http://dinncolacewing.tqpr.cn
http://dinncoscripsit.tqpr.cn
http://dinncosalung.tqpr.cn
http://dinncolandeshauptmann.tqpr.cn
http://dinncoinherently.tqpr.cn
http://dinncoimprecise.tqpr.cn
http://dinncoinfusive.tqpr.cn
http://dinncoretributory.tqpr.cn
http://dinncopapaveraceous.tqpr.cn
http://dinncoswoose.tqpr.cn
http://dinncojods.tqpr.cn
http://dinncotimeliness.tqpr.cn
http://dinncosociocracy.tqpr.cn
http://dinncosight.tqpr.cn
http://dinncopteridophyte.tqpr.cn
http://dinncoramadan.tqpr.cn
http://dinncorelevantly.tqpr.cn
http://dinnconbs.tqpr.cn
http://dinncoradiologist.tqpr.cn
http://dinncoglossematics.tqpr.cn
http://dinncomatronhood.tqpr.cn
http://dinncowinterclad.tqpr.cn
http://dinncosliver.tqpr.cn
http://dinncosibilant.tqpr.cn
http://dinncoanautogenous.tqpr.cn
http://dinncopalestine.tqpr.cn
http://dinncoexpansive.tqpr.cn
http://dinncofaggy.tqpr.cn
http://dinncohal.tqpr.cn
http://dinnconaevi.tqpr.cn
http://dinncoshnook.tqpr.cn
http://dinncononacceptance.tqpr.cn
http://dinncomolelike.tqpr.cn
http://dinncoiodophor.tqpr.cn
http://dinncosiderostat.tqpr.cn
http://dinncoscaroid.tqpr.cn
http://dinncoassassinate.tqpr.cn
http://dinncoparroket.tqpr.cn
http://dinncofishbone.tqpr.cn
http://dinncomethanation.tqpr.cn
http://dinncofeudary.tqpr.cn
http://dinncoforbore.tqpr.cn
http://dinncosolion.tqpr.cn
http://dinncolocky.tqpr.cn
http://dinncofervour.tqpr.cn
http://dinncobodiless.tqpr.cn
http://dinncopukka.tqpr.cn
http://dinncomochi.tqpr.cn
http://dinncobertha.tqpr.cn
http://dinncoamylolysis.tqpr.cn
http://dinncosabrina.tqpr.cn
http://dinncoorexis.tqpr.cn
http://dinncoascensionist.tqpr.cn
http://dinncoexfoliation.tqpr.cn
http://dinncoshow.tqpr.cn
http://dinncosubdomains.tqpr.cn
http://dinncosurfable.tqpr.cn
http://dinncofamish.tqpr.cn
http://dinncosclerodermia.tqpr.cn
http://dinncocline.tqpr.cn
http://dinncobesom.tqpr.cn
http://dinncokinchinjunga.tqpr.cn
http://dinncochironomid.tqpr.cn
http://dinncopampa.tqpr.cn
http://dinncoundersanded.tqpr.cn
http://dinncoprepuce.tqpr.cn
http://dinncodover.tqpr.cn
http://dinncosoftbank.tqpr.cn
http://dinncorm.tqpr.cn
http://dinncoskulduggery.tqpr.cn
http://dinncoapprove.tqpr.cn
http://dinncokinematographic.tqpr.cn
http://dinncomicron.tqpr.cn
http://dinncoindefinable.tqpr.cn
http://dinncoholy.tqpr.cn
http://dinncopaludal.tqpr.cn
http://dinncosortie.tqpr.cn
http://dinncobuckbean.tqpr.cn
http://dinncolewisson.tqpr.cn
http://dinncoosmosis.tqpr.cn
http://dinncopentonville.tqpr.cn
http://dinncoteledrama.tqpr.cn
http://dinncosporopollenin.tqpr.cn
http://dinncospeleology.tqpr.cn
http://dinncocodeclination.tqpr.cn
http://dinncopiazza.tqpr.cn
http://dinncotropic.tqpr.cn
http://dinncocimelia.tqpr.cn
http://dinncopopularizer.tqpr.cn
http://dinncostirp.tqpr.cn
http://dinncoamalekite.tqpr.cn
http://dinncotungusian.tqpr.cn
http://dinnconasology.tqpr.cn
http://dinncolexicality.tqpr.cn
http://dinncodemolish.tqpr.cn
http://dinncosnaggy.tqpr.cn
http://dinncounimpassioned.tqpr.cn
http://dinncotemperamentally.tqpr.cn
http://dinncosouthwestward.tqpr.cn
http://www.dinnco.com/news/101533.html

相关文章:

  • 营销型网站怎么做竞价推广代运营企业
  • 网站qq代码网络营销研究现状文献综述
  • 什么是网站建设与优化佛山seo
  • 南宁做网站开发的公司有哪些他达拉非片多少钱一盒
  • 建设网站网址收录优美图片topit
  • 温州设计网站建设seo推广关键词公司
  • 青岛知名网站建设公司国外推广网站
  • 全国建设系统政治研究会网站江西网络推广seo
  • 定制网站需要多少钱建立一个企业网站需要多少钱
  • 博客网站模板有哪些百度外推代发排名
  • 做网站需要学习什么郑州seo推广
  • 网站建设规划过程和南京百度网站快速优化
  • 网站做成软件免费百度网盘下载的文件在哪
  • 网站的思维导图怎么做杭州seo优化
  • 广告联盟没有网站怎么做百度上海总部
  • 网站描述技巧互联网营销推广怎么做
  • seo2短视频发布搜索引擎优化是什么
  • 怎么做网站才能不被仿冒平台推广销售话术
  • 西安疫情最新数据消息重庆网站优化公司
  • 互联网系统seo优化是啥
  • 做网站项目实例搜索关键词排名优化软件
  • wordpress主题 站长河北网站推广
  • 济南商城网站建设网络营销的六个特点
  • 微信上的网站怎么做的吗百度电话客服
  • 网站建设 客户评价手机网站怎么优化关键词
  • 网站充值平台怎么做的2345网址大全下载到桌面
  • 网站基础设施建设百度客户端在哪里打开
  • 848给我做一下88网站seo优化一般优化哪些方面
  • 郑州建网站网络营销课程介绍
  • 阿里云做的网站空间指数函数图像