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


TypeScript Meteor.startup方法代码示例

本文整理汇总了TypeScript中meteor/meteor.Meteor.startup方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Meteor.startup方法的具体用法?TypeScript Meteor.startup怎么用?TypeScript Meteor.startup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在meteor/meteor.Meteor的用法示例。


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

示例1: function

    return function(cls) {
        // get annotations
        let annotations = Reflect.getMetadata('annotations', cls) || [];
        // set selector if undefined
        args.selector = args.selector || 'ion-app';
        // if no template was provided, default so it has a root <ion-nav>
        if (!args.templateUrl && !args.template) {
            args.template = '<ion-nav></ion-nav>';
        }
        // create @Component
        annotations.push(new Component(args));
        // redefine with added annotations
        Reflect.defineMetadata('annotations', annotations, cls);
        // wait for meteor platform
        Meteor.startup(function() {
            // define array of bootstrap providers
            let providers = ionicProviders(args).concat(args.providers || [], METEOR_PROVIDERS);
            // auto add Ionic directives
            let directives = args.directives ? args.directives.concat(IONIC_DIRECTIVES) : IONIC_DIRECTIVES;
            // automatically provide all of Ionic's directives to every component
            providers.push(provide(PLATFORM_DIRECTIVES, { useValue: [directives], multi: true }));
            if (args.prodMode) {
                enableProdMode();
            }
            bootstrap(cls, providers).then( appRef => {
                postBootstrap(appRef, args.prodMode);
            });
            return cls;
        });

        return cls;
    }
开发者ID:metzc,项目名称:Ionic2-Meteor1.3-Starter,代码行数:32,代码来源:meteor-ionic-app.ts

示例2: loadChannels

export function loadChannels(){
    Meteor.startup(function(){
            for(let channel of channels){
                if(Channels.find().count()<1){
                    Channels.insert(channel);
                }
            }
      });

}
开发者ID:rollymaduk,项目名称:salesman,代码行数:10,代码来源:channels.ts

示例3: Promise

import { Mongo } from 'meteor/mongo';
import { config } from './config'


var Mysql = Npm.require('mysql');
var Client = Npm.require('ftp');

var genome, exp;

var pool = Mysql.createPool(config);

class main{
    public temp: Mongo.Cursor<Object>

}
Meteor.startup(() => {});

Meteor.methods({
    // Main insertion function
    'insert':function(data) {
        console.log('Ready to transfer data');
        return new Promise((resolve, reject)=> {
            pool.getConnection((err, connection) => {
                console.log('ok');
                var uid_list=[];
                data.forEach(function(listitem,index){
                    console.log('ITERATION _'+index);
                    connection.query(
                        //'UPDATE labdata SET ? WHERE id IN (3804,3803)',{notes:[data[index].notes]},(err,res)=>{
                        'INSERT INTO labdata SET ?', data[index] , (err, res)=> {
                            console.log(data[index]);
开发者ID:bharath-cchmc,项目名称:sra-interface,代码行数:31,代码来源:main.ts

示例4: enableProdMode

import './imports/polyfills';

import { Meteor } from 'meteor/meteor';

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './imports/app/app.module';

Meteor.startup(() => {

  if (Meteor.isProduction) {
    enableProdMode();
  }

  platformBrowserDynamic().bootstrapModule(AppModule);

});
开发者ID:Urigo,项目名称:angular-meteor,代码行数:17,代码来源:main.ts

示例5: importPictureFromUrl

Meteor.startup(() => {
  if (Meteor.settings) {
    Object.assign(Accounts._options, Meteor.settings['accounts-phone']);
    SMS.twilio = Meteor.settings['twilio'];
  }

  // Configuring oAuth services
  const services = Meteor.settings.private.oAuth;

  if (services) {
    for (let service in services) {
      ServiceConfiguration.configurations.upsert({service: service}, {
        $set: services[service]
      });
    }
  }

  if (Users.collection.find().count() > 0) {
    return;
  }

  let picture = importPictureFromUrl({
    name: 'man1.jpg',
    url: 'https://randomuser.me/api/portraits/men/1.jpg'
  });

  Accounts.createUserWithPhone({
    phone: '+972540000001',
    profile: {
      name: 'Ethan Gonzalez',
      pictureId: picture._id
    }
  });

  picture = importPictureFromUrl({
    name: 'lego1.jpg',
    url: 'https://randomuser.me/api/portraits/lego/1.jpg'
  });

  Accounts.createUserWithPhone({
    phone: '+972540000002',
    profile: {
      name: 'Bryan Wallace',
      pictureId: picture._id
    }
  });

  picture = importPictureFromUrl({
    name: 'woman1.jpg',
    url: 'https://randomuser.me/api/portraits/women/1.jpg'
  });

  Accounts.createUserWithPhone({
    phone: '+972540000003',
    profile: {
      name: 'Avery Stewart',
      pictureId: picture._id
    }
  });

  picture = importPictureFromUrl({
    name: 'woman2.jpg',
    url: 'https://randomuser.me/api/portraits/women/2.jpg'
  });

  Accounts.createUserWithPhone({
    phone: '+972540000004',
    profile: {
      name: 'Katie Peterson',
      pictureId: picture._id
    }
  });

  picture = importPictureFromUrl({
    name: 'man2.jpg',
    url: 'https://randomuser.me/api/portraits/men/2.jpg'
  });

  Accounts.createUserWithPhone({
    phone: '+972540000005',
    profile: {
      name: 'Ray Edwards',
      pictureId: picture._id
    }
  });
});
开发者ID:DAB0mB,项目名称:ionic2-meteor-messenger,代码行数:86,代码来源:main.ts

示例6: loadTestData

'use strict';

import {Meteor} from 'meteor/meteor';

import {loadTestData} from './test_data';
import './pubs';

Meteor.startup(function() {
  loadTestData();
});
开发者ID:Hongbo-Miao,项目名称:angular2-meteor-universal,代码行数:10,代码来源:main.ts

示例7: function

    name: string;
}
var Monkeys = new Mongo.Collection<MonkeyDAO>('monkeys');
//var x = new Mongo.Collection<xDAO>('x');
//var y = new Mongo.Collection<yDAO>('y');
/********************************** End setup for tests *********************************/


/**
 * From Core, Meteor.startup section
 * Tests Meteor.isServer, Meteor.startup, Collection.insert(), Collection.find()
 */
if (Meteor.isServer) {
    Meteor.startup(function () {
        if (Rooms.find().count() === 0) {
            Rooms.insert({ name: "Initial room" });
        }
    });
}

/**
 * From Publish and Subscribe, Meteor.publish section
 **/
Meteor.publish("rooms", function () {
    return Rooms.find({}, { fields: { secretInfo: 0 } });
});

Meteor.publish("adminSecretInfo", function () {
    return Rooms.find({ admin: this.userId }, { fields: { secretInfo: 1 } });
});
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:30,代码来源:meteor-tests.ts

示例8:

import { Meteor }     from 'meteor/meteor';
import { Quotes }     from '../collections/quotes';
import quotesData     from './quotes.data';

// Init Data if (Quotes) Collection is empty
Meteor.startup(() => {
  if (Quotes.find().count() == 0)
    quotesData.forEach(quote => Quotes.insert(quote) );
});
开发者ID:nebiljabari,项目名称:RESTberry_Pi,代码行数:9,代码来源:startup.ts

示例9: throwUnlessAuthed

    return true;
}

export function throwUnlessAuthed(self, logData) {
    if (!isAuthed(self)) {
        Logger.error(self, {type: 'not-authorized', requested: logData});
        throw new Meteor.Error("not-authorized");
    }
}

const denyAll = {
    insert() { return true; },
    update() { return true; },
    remove() { return true; },
};
export function denyAllCollectionMethods(collection) {
    collection.deny(denyAll);
}

Meteor.startup(function () {
    MeteorMethodsUnsafe({
        isAuthed: function() {
            return isAuthed(this);
        },

        getMyEmail: function() {
            return getEmail(this);
        }
    });
});
开发者ID:,项目名称:,代码行数:30,代码来源:

示例10: moment

Meteor.startup(() => {
  if (Chats.find({}).cursor.count() === 0) {
    let chatId;

    chatId = Chats.collection.insert({
      title: 'Ethan Gonzalez',
      picture: 'https://randomuser.me/api/portraits/thumb/men/1.jpg'
    });

    Messages.collection.insert({
      chatId: chatId,
      content: 'You on your way?',
      createdAt: moment().subtract(1, 'hours').toDate(),
      type: MessageType.TEXT
    });

    chatId = Chats.collection.insert({
      title: 'Bryan Wallace',
      picture: 'https://randomuser.me/api/portraits/thumb/lego/1.jpg'
    });

    Messages.collection.insert({
      chatId: chatId,
      content: 'Hey, it\'s me',
      createdAt: moment().subtract(2, 'hours').toDate(),
      type: MessageType.TEXT
    });

    chatId = Chats.collection.insert({
      title: 'Avery Stewart',
      picture: 'https://randomuser.me/api/portraits/thumb/women/1.jpg'
    });

    Messages.collection.insert({
      chatId: chatId,
      content: 'I should buy a boat',
      createdAt: moment().subtract(1, 'days').toDate(),
      type: MessageType.TEXT
    });

    chatId = Chats.collection.insert({
      title: 'Katie Peterson',
      picture: 'https://randomuser.me/api/portraits/thumb/women/2.jpg'
    });

    Messages.collection.insert({
      chatId: chatId,
      content: 'Look at my mukluks!',
      createdAt: moment().subtract(4, 'days').toDate(),
      type: MessageType.TEXT
    });

    chatId = Chats.collection.insert({
      title: 'Ray Edwards',
      picture: 'https://randomuser.me/api/portraits/thumb/men/2.jpg'
    });

    Messages.collection.insert({
      chatId: chatId,
      content: 'This is wicked good ice cream.',
      createdAt: moment().subtract(2, 'weeks').toDate(),
      type: MessageType.TEXT
    });
  }
});
开发者ID:davidyaha,项目名称:angular-meteor,代码行数:65,代码来源:main.ts


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