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


TypeScript platypus.register类代码示例

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


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

示例1:

import {async, register} from 'platypus';
import BaseService from '../base/base.svc';

export default class NewcontactService extends BaseService {

}

register.injectable('newcontact-svc', NewcontactService);
开发者ID:Jesla,项目名称:DepotULab-SupplementalPlatypusTSContacts,代码行数:8,代码来源:newcontact.svc.ts

示例2: newPost

            console.log(success);
            return success.response;
        });
    }

    newPost(postdata: models.IPost): async.IAjaxThenable<Array<models.IPost>> {
        return this.http.json<Array<models.IPost>>({
            method: 'POST',
            url: this.host + '/posts',
            data: postdata
        }).then((success) => {
            console.log(success);
            return success.response;
        });
    }
    
    getSpecificPost(params: any): async.IAjaxThenable<Array<models.IPost>> {
        return this.http.json<Array<any>>({
            method: 'GET',
            url: this.host + '/posts/' + params
        }).then((success) => {
            return success.response;
        });
    }
    
    

}

register.injectable('postrequests-svc', PostrequestsService);
开发者ID:crbrasfield,项目名称:PlatTSBlog,代码行数:30,代码来源:postrequests.svc.ts

示例3: constructor

import {App, events, register, routing, web} from 'platypus';
import HomeViewControl from '../viewcontrols/home/home.vc';
import GreetingViewControl from '../viewcontrols/greeting/greeting.vc';

export default class MyApp extends App {
    constructor(router: routing.Router, config: web.IBrowserConfig) {
        super();

		config.routingType = config.STATE;

        router.configure([
            { pattern: '', view: HomeViewControl },
            { pattern: "greet/:nameToGreet", view: GreetingViewControl}
        ]);
    }

    error(ev: events.ErrorEvent<Error>): void {
        console.log(ev.error);
    }
}

register.app('app', MyApp, [
    routing.Router,
    web.IBrowserConfig
]);
开发者ID:treeplantedbystreams,项目名称:PlatypusBlog,代码行数:25,代码来源:app.ts

示例4: getAllPosts

import {async, register} from 'platypus';
import BaseService from '../base/base.svc';

export default class PostService extends BaseService {
    getAllPosts(): async.IAjaxThenable<Array<any>> { 
        return this.http.json<any>({
            method: 'GET',
            url: this.host + ''
        }).then((success) => {
            
            return success.response.data.children;
        }, (err) => {
            console.log(err);
            throw err;
        });
    }
}

register.injectable('post-svc', PostService);
开发者ID:Bcaskey,项目名称:Lab_17_Reddit,代码行数:19,代码来源:post.svc.ts

示例5: logInUser

        });
    }
    
    logInUser(email:string, password: string): async.IThenable<any> {
        return this.firebaservice.logInUser(email, password).then((success) => {
            // console.log(success);
            this.storage.setItem('username', success.uid);
            this.userID = success.uid;
            return success;
        });
    }
    
    deleteThisPost(key:any, id:any) {
        this.firebaservice.deleteThisPost(key, id);
    }
    
    postUserTask(task:Object){
        this.firebaservice.postUserTask(task)
    }
    
    updateUserTask(updatedTask:any, postkey:any){
        let task = updatedTask;
        let key = postkey;
        this.firebaservice.updateUserTask(task, key);
    }

    
}

register.injectable('firebase-repo', FirebaseRepository, [firebaseservice, storage.LocalStorage]);
开发者ID:tom5265,项目名称:onTrack,代码行数:30,代码来源:firebase.repo.ts

示例6: createPost

            method: 'GET',
            url: this.host + '/posts/' + id,
        }).then(
            (success) => {
                //console.log(success);
                return success.response;
            },
            (error): any => {
                throw error.response.message;
            }
        );
    }
    
    createPost(post:{}):async.IThenable<models.IBlank> {
        return this.http.json({
            method: 'POST',
            url: this.host + '/posts/',
            data: post
        }).then(
            (success) => {
                return success;
            },
            (error): any => {
                throw error.response.message;
            }
        );
    }
}

register.injectable('api-svc', APIService);
开发者ID:joel-valencia,项目名称:DepotU_Lab_16,代码行数:30,代码来源:api.svc.ts

示例7: constructor

import {async, register} from 'platypus';
import BaseRepository from '../base/base.repo';
import EntryService from '../../services/entry/entry.svc';

export default class EntryRepository extends BaseRepository {
    
    constructor(private entrySvc: EntryService) {
        super();
    }
    
    getRedditList(): async.IThenable<Array<models.IEntry>> {
        let entryArray: Array<any> = [];
        return this.entrySvc.getRedditList().then((success) => {
            for(let i = 0; i < success.length; i++) {
                let entry = {
                    "title": success[i].data.title,
                    "author": success[i].data.author,
                    "id": success[i].data.id,
                    "thumbnail": success[i].data.thumbnail
                };
                entryArray.push(entry);    
                }
                return entryArray;
        });

    }
}


register.injectable('entry-repo', EntryRepository, [EntryService]);
开发者ID:awatson32,项目名称:PlatypusTS-reddit,代码行数:30,代码来源:entry.repo.ts

示例8: constructor

import {async, register} from 'platypus';
import BaseRepository from '../base/base.repo';
import PostService from '../../services/post/post.svc'; // step 1 in requesting dependency. letting TS know where to find it and what it's called

export default class StorageRepository extends BaseRepository {
    
    constructor(private postSvc: PostService) {
        super();
    }

    getAllPosts(): async.IThenable<Array<models.IBlogPost>> {
        return this.postSvc.getAllPosts();
    }
    
    getPost(postId: string): async.IThenable<models.IBlogPost> {
        return this.postSvc.getPost(postId);
    }
    
    submitPost(post: models.IBlogPost): async.IThenable<string> {
        return this.postSvc.submitPost(post);
    }
}

register.injectable('storage-repo', StorageRepository, [PostService]);
开发者ID:treeplantedbystreams,项目名称:ContactKeeper_Plat,代码行数:24,代码来源:storage.repo.ts

示例9: constructor

import {async, register} from 'platypus';
import BaseRepository from '../base/base.repo';
import BlogService from '../../services/blog/blog.svc';

export default class BlogRepository extends BaseRepository {
    
    constructor(private blogService: BlogService) {//variable calling the injectable below[]
        super();//this is the dependance injection. Must call super. 
    }

    getAllPosts(): async.IThenable<Array<models.IBlog>> {
        return this.blogService.getAllPosts();
    }
    
    getSinglePost(id: string): async.IThenable<Array<models.IBlog>> {
        return this.blogService.getSinglePost(id);
    }

    NewPost(myPost:models.IBlog): async.IThenable<string> {
        return this.blogService.NewPost(myPost);
    }
}

register.injectable('blog-repo', BlogRepository, [BlogService]);
开发者ID:Bcaskey,项目名称:Lab_16_Blog,代码行数:24,代码来源:blog.repo.ts

示例10: getRedditList

import {async, register} from 'platypus';
import BaseService from '../base/base.svc';


export default class EntryService extends BaseService {
    
    getRedditList(): async.IAjaxThenable<Array<models.IEntry>> {
        return this.http.json<any>({
            method: 'GET',
            url: this.host + 'Showerthoughts.json'
        }).then((success) => {
            return success.response.data.children;
        }, (err) => {
            console.log(err);
            throw err;
        });
    }
}

register.injectable('entry-svc', EntryService);
开发者ID:awatson32,项目名称:PlatypusTS-reddit,代码行数:20,代码来源:entry.svc.ts


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