zoukankan      html  css  js  c++  java
  • Electrom will-download pause function

    1、code from github

    url-link:

       https://github.com/electron/electron/issues/7712

    // to store downloadItems
    var downloadItems = [];
    
    ipcMain.on('dowloadFiles', function(evt, options) {
        // ...
        if(options.command === 'stopDownload') {
               var item = getDownloadItem(options.url); // fetch item from downloadItems array
               item.pause();
               return;
          }
        // ...
    });
    
    mainWindow.webContents.session.on('will-download', function(event, item, webContents) {
        // ...
    
          // store the download item, so that we can call item.pause/resume in a 
          downloadItems.push(item);
    
        // ...
    });
    

      

  • 相关阅读:
    C++官方文档-静态成员
    C++官方文档-this
    C++官方文档-运算符重载
    springboot-dokcer
    HDU 1073
    HDU 1070
    UVa 213
    HDU 1150
    POJ 1274
    POJ 2594
  • 原文地址:https://www.cnblogs.com/cbugs/p/10096078.html
Copyright © 2011-2022 走看看