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


TypeScript electron-json-storage.get函数代码示例

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


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

示例1: function

$('body').on('click', '#db-dialog #add-btn', function(event) {
  let $form = $('#db-dialog form'),
      $name = $form.find('input[name="Name"]'),
      $url = $form.find('input[name="MongoDB URL"]'),
      $resp = $form.find('.response');
  if ($name.val() === '') {
    pushResponse($resp, 'Name field cannot be empty.');
    return;
  }
  storage.get('dbs', function(error, dbs) {
    if (error) {
      console.error(error);
    } else {
      if (_.contains(_.map(dbs, (db: DBEntry) => { return db.name; }), $name.val())) {
        pushResponse($resp, 'Key already exists.');
      } else {
        if (_.isEmpty(dbs)) {
          dbs = [];
        }
        dbs.push({
          name: $name.val(),
          url: $url.val()
        });
        storage.set('dbs', dbs, function(error) {
          if (error) {
            console.error(error);
          } else {
            pushResponse($resp, 'Entry added successfully.');
          }
        });
      }
    }
  });
});
开发者ID:hack-rpi,项目名称:Email-Board,代码行数:34,代码来源:db-dialog.ts

示例2: function

 fs.readFile(__dirname + '/../templates/email.mst', 'utf-8', (error, template) => {
   if (error) {
     console.error(error);
   } else {
     tmp_files.push(tmpobj);
     let rendered = Mustache.render(template, {email: tmpobj.name});
     $('.content').html(rendered);
     storage.get('queries', function(error, queries) {
       if (error) {
         console.error(error);
       } else {
         let hound = new Bloodhound({
           datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
           queryTokenizer: Bloodhound.tokenizers.whitespace,
           identify: (q) => { return q.name; },
           local: queries
         });
         $('input[name="query"]').typeahead({
           hint: true,
           minLength: 0,
           highlight: true
         }, {
           name: 'queries',
           display: 'name',
           source: hound
         });
       }
     });
   }
 });
开发者ID:hack-rpi,项目名称:Email-Board,代码行数:30,代码来源:email.ts

示例3: function

 click: function() {
   storage.get('mailgun', function(error, data) {
     if (error) {
       console.error(error);
     } else {
       popup.open('mailgun-modal.mst', 'mailgun-dialog', data);
     }
   });
 }
开发者ID:hack-rpi,项目名称:Email-Board,代码行数:9,代码来源:menu.ts

示例4: function

 fs.readFile(__dirname + '/../templates/index.mst', 'utf-8', (error, template) => {
   if (error) {
     console.error(error);
   } else {
     storage.get('templates', function(error, templates) {
       if (error) {
         console.error(error);
       } else {
         let rendered = Mustache.render(template, {templates: templates});
         $('.content').html(rendered);
       }
     });
   }
 });
开发者ID:hack-rpi,项目名称:Email-Board,代码行数:14,代码来源:main.ts

示例5: function

$('body').on('click', '#query-dialog #add-btn', function(event) {
  let $form = $('#query-dialog form'),
      $name = $form.find('input[name="Name"]'),
      $collection = $form.find('input[name="Collection"]'),
      $query = $form.find('textarea[name="Query"]'),
      $resp = $form.find('.response');
  if ($name.val() === '') {
    return pushResponse($resp, 'Name field cannot be empty.');
  }
  if ($collection.val() === '') {
    return pushResponse($resp, 'Collection field cannot be empty.');
  }
  try {
    JSON.parse($query.val());
  } catch (e) {
    return pushResponse($resp, 'Invalid query.');
  }
  storage.get('queries', function(error, queries) {
    if (error) {
      console.error(error);
    } else {
      if (_.contains(_.map(queries, (q: QueryEntry) => { return q.name; }), $name.val())) {
        pushResponse($resp, 'Key already exists.');
      } else {
        if (_.isEmpty(queries)) {
          queries = [];
        }
        queries.push({
          name: $name.val(),
          collection: $collection.val(),
          query: $query.val()
        });
        storage.set('queries', queries, function(error) {
          if (error) {
            console.error(error);
          } else {
            pushResponse($resp, 'Entry added successfully.');
          }
        });
      }
    }
  });
});
开发者ID:hack-rpi,项目名称:Email-Board,代码行数:43,代码来源:query-dialog.ts

示例6: reject

			storage.has(TWITTER_CREDENTIALS_KEY, (err, hasKey) => {
				if (err) {
					reject(err)
				}
				if (hasKey) {
					storage.get(TWITTER_CREDENTIALS_KEY, (err, result) => {
						if (err) {
							reject(err)
						}
						resolve(result as TwitterCredentials)
					})
					return
				}
				this.fetchTwitterCredentials()
					.then(result => {
						storage.set(TWITTER_CREDENTIALS_KEY, result, (err) => {
							if (err) {
								reject(err)
							}
							resolve(result as TwitterCredentials)
						})
					})
			})
开发者ID:castaneai,项目名称:nowpl,代码行数:23,代码来源:user-storage.ts

示例7: Promise

 return new Promise((resolve, reject) => {
     get(CONFIG, (error: any, data: SettingState) => error ? reject(error) : resolve(data));
 });
开发者ID:tadashi-aikawa,项目名称:todoistoggl,代码行数:3,代码来源:ConfigClient.ts

示例8: function

/// <reference path="../../typings/index.d.ts" />
/// <reference path="../../definitions/index.d.ts" />

import * as $ from 'jquery';
import * as storage from 'electron-json-storage';
import {close} from './popup';

export let api_key = '';
export let domain = '';

storage.get('mailgun', function(error, data) {
  if (error) {
    console.error(error);
  } else {
    api_key = data.api_key;
    domain = data.domain;
  }
});

$('body').on('click', '#mailgun-dialog .button#save', function(event) {
  api_key = $('#mailgun-dialog input[name="API Key"]').val();
  domain  = $('#mailgun-dialog input[name="Domain"]').val();
  storage.set('mailgun', { api_key: api_key, domain: domain}, function(error) {
    if (error) {
      console.error(error);
    }
  });
  close();
});
开发者ID:hack-rpi,项目名称:Email-Board,代码行数:29,代码来源:mailgun-dialog.ts

示例9: require

// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process.
import { bootstrap } from '@angular/platform-browser-dynamic'

import { provideStore } from '@ngrx/store'
import { runEffects } from '@ngrx/effects'

import { Counter, counterReducer } from "./components/counter"

import { ElectronSaverEffect, STATE_PROP } from './helpers/hot-reloader'
import { remote } from 'electron'

const storage: any = require('electron-json-storage')

storage.get(STATE_PROP, (err: any, data: any) => {
  console.log(data)

  bootstrap(Counter, [
    provideStore({ counter: counterReducer }, data),
    runEffects(ElectronSaverEffect)
  ])
})
开发者ID:mnmaraes,项目名称:electron-ng2-template,代码行数:23,代码来源:renderer.ts


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