当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript express-session.save函数代码示例

本文整理汇总了TypeScript中express-session.save函数的典型用法代码示例。如果您正苦于以下问题:TypeScript save函数的具体用法?TypeScript save怎么用?TypeScript save使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了save函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 Storages.getStorage(session.selectedCloud).callbackHandler(req.query, (creds => {
     if (!creds) {
         res.end("Error");
         return;
     }
     session.clouds[session.selectedCloud].creds = creds;
     session.save();
     res.redirect('/');
 }));
开发者ID:jazz19972,项目名称:n00b,代码行数:9,代码来源:server.ts

示例2: function

io.on('connection', function (client) {
    var sessionID = client.conn.request.sessionID;
    var session = client.conn.request.session;
    //Process Session
    if (!session.clouds) {
        session.clouds = Storages.getTemplate();    //an object like : {"Gdrive":{displayName:"..",url:".."},"..":{displayName:"..","url":".."}}
        session.selectedCloud = "GDrive";
        //config
        session.config = {
            clientDownload: {
                value: false,
                displayName: "Stream downloads to user",
                type: "checkbox",
                title: "Choose whether to stream file to client while catching downloads or not, if unchecked windows will close after download is captured."
            },
            csHead: {
                value: true,
                displayName: "Show cloud selection button in main menu",
                type: "checkbox"
            },
            askForName: {
                value: true,
                displayName: "Ask for filename when uploading files",
                type: "checkbox"
            }
        }
        session.save();
    }
    //send config
    client.emit('setObj', {
        name: "config",
        value: session.config
    })
    //send clouds
    client.emit('setObj', {
        name: 'clouds',
        value: session.clouds
    });
    client.emit('setObj', {
        name: 'selectedCloud',
        value: session.clouds[session.selectedCloud]
    });
    //send downloads
    client.emit('setObj', {
        name: 'visitedPages',
        value: visitedPages
    });
    //send torrrents
    client.emit('setObj', {
        name: 'torrents',
        value: torrents
    });
    client.emit('setObj', {
        name: 'incognito',
        value: session.incognito ? session.incognito : false
    });
    client.on('clearVisitedPages', () => {
        Object.keys(visitedPages).forEach((id) => {
            clearVisitedPage(id);
        });
    });
    client.on('clearTorrents', () => {
        Object.keys(torrents).forEach((id) => {
            clearTorrent(id);
        });
    });
    client.on('delete', data => {
        data.isTorrent ? clearTorrent(data.id) : clearVisitedPage(data.id);
    });
    client.on('saveToDrive', (data) => {
        saveToDriveHandler(session, data);
    });
    client.on('pin', (data) => {
        if (data.isTorrent) {
            torrents[data.page.id].pinned = true;
            sendTorrentsUpdate(io, data.page.id, ["pinned"]);
            return false;
        }
        visitedPages[data.page.id].pinned = true;
        sendVisitedPagesUpdate(io, data.page.id, ["pinned"]);
    });
    client.on('unpin', (data) => {
        if (data.isTorrent) {
            torrents[data.page.id].pinned = false;
            sendTorrentsUpdate(io, data.page.id, ["pinned"]);
            return false;
        }
        visitedPages[data.page.id].pinned = false;
        sendVisitedPagesUpdate(io, data.page.id, ["pinned"]);
    });
    client.on('pirateSearch', (data) => {
        var query = data.query;
        var page = data.page;
        scrapeIt(`https://thepiratebay.org/search/${encodeURIComponent(query)}/${page}/7/0`, {
            result: {
                listItem: "tr:not(.header)",
                data: {
                    name: "a.detLink",
                    size: {
                        selector: ".detDesc",
//.........这里部分代码省略.........
开发者ID:jazz19972,项目名称:n00b,代码行数:101,代码来源:server.ts


注:本文中的express-session.save函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。