小编Vad*_*gon的帖子

在Electron中与<webview>进行通信

我有一个<webview>在我的电子应用程序中.我想有安全的"洋"沟通,顺便我会继续iframe通过postMessage.例如:

webview.executeJavaScript("window.parent.postMessage('all done!')");

我是否可以选择与此子网站进行通信,nodeIntegration以便我可以使用sendToHostnodeIntegration为这一个功能打开所有功能似乎有点矫枉过正.

electron

10
推荐指数
1
解决办法
7924
查看次数

Typescript编译器错误TS2307:找不到模块'jquery'

我正在关注JSPM入门指南,我想安装jquery包,所以我执行下面的命令.

jspm install jquery

但是当我尝试在下面的打字稿中导入它时

import $ from 'jquery'

我从typescript编译器得到一个错误说error TS2307: Cannot find module 'jquery'.不仅对于其他库的这个库我得到了同样的错误.

javascript typescript systemjs jspm

7
推荐指数
1
解决办法
8920
查看次数

电子饼干

对于电子 cookie,我使用了https://www.npmjs.com/package/electron-cookies

然后将其添加到我的html中

<script type="text/javascript">
require('electron-cookies')
function createCookie(name,value,days) {
    if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
                        document.cookie = name+"="+value+expires+"; path=/";
                    }

                    function getCookie12(name) {
                      var regexp = new RegExp("(?:^" + name + "|;\s*"+ name + ")=(.*?)(?:;|$)", "g");
                      var result = regexp.exec(document.cookie);
                      alert(document.cookie);
                      return (result === null) ? null : result[1];
                    }
    </script>
Run Code Online (Sandbox Code Playgroud)

并调用方法:

<button onclick="createCookie('ppkcookie','testcookie',7)">Set Cookie</button>
<button onclick="getCookie12('ppkcookie')">Get Cookie</button>
Run Code Online (Sandbox Code Playgroud)

alert(document.cookie) 只显示我

ppkcookie不是ppkcookie=testcookie

有什么想法吗? …

javascript cookies electron

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

electron ×2

javascript ×2

cookies ×1

jspm ×1

systemjs ×1

typescript ×1