zoukankan      html  css  js  c++  java
  • Promise 练习

    import { ModelClass } from "engine/injector/Injector";
    import { Inject } from "core/injector/Injector";
    import { environment } from "engine/env/Environment";
     
    @ModelClass
    export class ExerciseProxy {
     
    private polyfill_suffix : string = "/s17/lib/polyfill/polyfill.min.js" ;
    private vue_suffix : string = "/s17/lib/vue/2.2.5/vue.min.js" ;
    private vuex_suffix : string = "/s17/lib/vue/plugin/vuex/2.2.1/vuex.min.js" ;
    private venus_js_suffix : string = "/s17/lib/venus/2.5.1/venus.min.js" ;
    private venus_css_suffix : string = "/s17/lib/venus/2.5.1/css/venus.min.css" ;
     
    private initialized : boolean = false ;
     
    public startInitialize( completeCbk: ( ) => void): void
    {
    if ( this.initialized ) {
    setTimeout( function () {
    completeCbk( ) ;
    }, 0 ) ;
    }
    let __promise = window["Promise"] ;
    let env: string = environment.env ;
    let promise = new __promise( ( resolove, reject ) => {
    let script = document.createElement("script") ;
    script.type = 'text/javascript';
    document.head.appendChild( script ) ;
    let url = environment.toCDNHostURL(this.polyfill_suffix, false, false) ;
    script.onload = function ( evt: Event ): void {
    resolove("polyfill success") ;
    } ;
    script.src = url ;
    } ) ;
     
    promise.then( (data: string) => {
    let promise = new __promise( ( resolove, reject ) => {
    let script = document.createElement("script") ;
    script.type = 'text/javascript';
    document.head.appendChild( script ) ;
    let url = environment.toCDNHostURL(this.vue_suffix, false, false) ;
    script.onload = function ( evt: Event ): void {
    resolove("vue success") ;
    } ;
    script.src = url ;
    } ) ;
     
    return promise ;
    } ).then( (data: string) => {
    let promise = new __promise( ( resolove, reject ) => {
    let script = document.createElement("script") ;
    script.type = 'text/javascript';
    document.head.appendChild( script ) ;
    let url = environment.toCDNHostURL(this.vuex_suffix, false, false) ;
    script.onload = function ( evt: Event ): void {
    resolove("vuex success") ;
    } ;
    script.src = url ;
    } ) ;
     
    return promise ;
    } ).then( (data: string) => {
    let promise = new __promise( ( resolove, reject ) => {
    let script = document.createElement("script") ;
    script.type = 'text/javascript';
    document.head.appendChild( script ) ;
    let url = environment.toCDNHostURL(this.venus_js_suffix, false, false) ;
    script.onload = function ( evt: Event ): void {
    resolove("venus_js success") ;
    completeCbk( ) ;
    } ;
    script.src = url ;
    } ) ;
     
    return promise ;
    } ).then( (data: string) => {
    let promise = new __promise( ( resolove, reject ) => {
    let link = document.createElement('link');
    link.rel = 'stylesheet';
    link.type = 'text/css';
    document.head.appendChild( link ) ;
    let url = environment.toCDNHostURL(this.venus_css_suffix, false, false) ;
    link.onload = function ( evt: Event ): void {
    resolove("venus_css success") ;
    completeCbk( ) ;
    } ;
    link.href = url ;
    } ) ;
     
    return promise ;
    } ) ;
    }
    }
     
     
  • 相关阅读:
    FactoryBean的作用
    ztree点击文字勾选checkbox,radio实现方法
    js判断字符长度 汉字算两个字符
    双系统引导修复
    thinkpadT440p
    分布式服务器集群
    Eclipse插件安装方式
    用SourceTree轻巧Git项目图解
    廖雪峰git使用完整教程
    hessian
  • 原文地址:https://www.cnblogs.com/jason-beijing/p/10327451.html
Copyright © 2011-2022 走看看