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


TypeScript firebase.storage函数代码示例

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


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

示例1: constructor

  constructor() {
    /**
    * Here we create the references I told you about 2 seconds ago :P
    */
    this.currentUser = firebase.auth().currentUser;
    this.userProfile = firebase.database().ref('/userProfile');
		this.profilePictureRef = firebase.storage().ref('/userProfile/');
  }
开发者ID:EliuFlorez,项目名称:firebase-auth,代码行数:8,代码来源:profile-data.ts

示例2: constructor

  constructor() {

    this.currentUser = firebase.auth().currentUser.uid;
    this.eventList = firebase.database().ref(`userProfile/${this.currentUser}/eventList`);
    this.itemList = firebase.database().ref(`userProfile/${this.currentUser}/itemList`);
    this.pubItems = firebase.database().ref('/pubItems');

    this.messageRooms = firebase.database().ref('/messages')

    this.messageList = firebase.database().ref('/messages/1/messageList');

    this.profilePictureRef = firebase.storage().ref('/messageImgs/');
    this.itemPictureRef = firebase.storage().ref('/itemImgs/');

    this.pictureRef = firebase.storage().ref('/messageImgs/1/');

 

  }
开发者ID:osmirmariano,项目名称:chatIonic,代码行数:19,代码来源:event-data.ts

示例3:

        Object.keys(animations).forEach(function (animKey) {
          console.log(animations[animKey].name);
          animations_library.push(animations[animKey].name);

          firebase.storage().ref('jsonFiles').child(animations[animKey].name + '.json').getDownloadURL().then(function (downloadUrl) {
            console.log(downloadUrl);
            console.log(typeof(downloadUrl));
            $('#anim_url').attr('value', downloadUrl);
            gameInstance.SendMessage('RTClipEditor', 'LoadAnimFromUrl', downloadUrl);
          });
        });
开发者ID:dan-singer,项目名称:norahAngular,代码行数:11,代码来源:motion-editor.component.ts

示例4: removePost

 removePost(deletePost: Blog){
     let dbRef = firebase.database().ref('blogPosts/').child(deletePost.id).remove();
     alert('post deleted');
     let imageRef = firebase.storage().ref().child(`images/${deletePost.imgTitle}`)
         .delete()
             .then(function() {
                 alert(`${deletePost.imgTitle} was deleted from Storage`);
             }).catch(function(error) {
                 alert(`Error - Unable to delete ${deletePost.imgTitle}`);
             });
 }
开发者ID:revnique,项目名称:ng4end2end,代码行数:11,代码来源:blog-admin.service.ts

示例5: uuid

 return this.afAuth.authState.first().flatMap((user) => {
   const userUid = user.uid;
   const filename = uuid();
   const path = `${userUid}/${filename}`;
   const storage = firebase.storage().ref(path);
   const metadata: firebase.storage.UploadMetadata = contentType && { contentType };
   const putPromise = file instanceof File
     ? storage.put(file, contentType)
     : storage.putString(file, firebase.storage.StringFormat.RAW, metadata);
   return Observable.fromPromise(putPromise);
 });
开发者ID:blmsl,项目名称:memories,代码行数:11,代码来源:file.service.ts

示例6: fileChange

 fileChange(event) {
   var files = event.srcElement.files;
   var file = files[0];
   var storageUrl = 'images/';
   var name = `img-${Date.now()}.jpg`;
   var storageRef = firebase.storage().ref(storageUrl + name);
   storageRef.put(file).then(function(snapshot) {
     //get the download URL
     console.log(snapshot.downloadURL)
     localStorage.setItem("currFile",snapshot.downloadURL);
   }); 
 }
开发者ID:jlooper,项目名称:quicknoms,代码行数:12,代码来源:home.component.ts

示例7: ajax

        $form.validator().on('submit', (e: JQueryEventObject) => {
            const is_valid = !e.isDefaultPrevented();

            if (!is_valid) {
                return;
            }

            e.preventDefault();

            const file = e.target[3].files[0];

            if (!file) {
                const form_data = `${$($form).serialize()}`;

                ajax(form_data);

                return false;
            }

            $($form).find(':submit').attr('disabled', 'disabled');

            const uploadTask = firebase.storage().ref().child(`media/${file.name}`).put(file, { contentType: file.type });

            uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, (snapshot) => {
                let progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
                $($form).find(':submit').html(`Uploading... ${parseInt(progress, 10)}%`);
            }, error => console.log(error), () => {
                $($form).find(':submit').html(`Saving...`);

                const form_data = `${$($form).serialize()}&downloadUrl=${uploadTask.snapshot.downloadURL}`;

                ajax(form_data);
            });

            function ajax(data) {
                $.ajax({
                    url: '/dashboard/create/promo',
                    method: 'post',
                    data: data
                }).then(res => {
                    $($form).find(':submit').html(`Done`);
                    window.location.replace('/dashboard');
                });
            }
        });
开发者ID:iamrelos,项目名称:ElComiteUrbano.Com,代码行数:45,代码来源:dashboard.ts

示例8: createPost

 createPost(post: Blog){
     let storageRef = firebase.storage().ref();
     storageRef.child(`images/${post.imgTitle}`).putString(post.img, 'base64')
         .then((snapshot) => { 
             let url = snapshot.metadata.downloadURLs[0];
             let dbRef = firebase.database().ref('blogPosts/');
             let newPost = dbRef.push();
             newPost.set ({
                 title: post.title,
                 content: post.content,
                 imgTitle: post.imgTitle,
                 img: url,
                 id: newPost.key
             });         
         })
         .catch ((error)=>{
             alert(`failed upload: ${error}`);
         });            
 }
开发者ID:revnique,项目名称:ng4end2end,代码行数:19,代码来源:blog-admin.service.ts

示例9: constructor

  constructor() {
      

      this.profilePicture = firebase.storage().ref('profilePic');
      this.messages = firebase.database().ref('/messages');
      this.pubItemList = firebase.database().ref('/pubItems');
      this.currentUser = firebase.auth().currentUser;

      this.itemList = firebase.database().ref(`/userProfile/${this.currentUser.uid}/itemList`);
      this.userRooms = firebase.database().ref(`/userProfile/${this.currentUser.uid}/rooms`);
      this.pubRooms = firebase.database().ref('/pubs');
      this.userContactP = firebase.database().ref(`/userProfile/${this.currentUser.uid}/contactsPadd/`);
      this.userContacts = firebase.database().ref(`/userProfile/${this.currentUser.uid}/contacts/`);

      this.groupRoom = firebase.database().ref(`/userProfile/${this.currentUser.uid}/groupChat`);
      this.groupChatInvi = firebase.database().ref(`/userProfile/${this.currentUser.uid}/groupChatInvitation`);
      this.userProfile = firebase.database().ref('/userProfile');

  }
开发者ID:osmirmariano,项目名称:chatIonic,代码行数:19,代码来源:profile-data.ts

示例10: getGoldScreenshotImageUrl

 /** Get the firebase storage golden image folder url */
 getGoldScreenshotImageUrl(filename: string): firebase.Promise<string> {
   return firebase.storage().ref('goldens').child(filename).getDownloadURL();
 }
开发者ID:HemanthKona,项目名称:material2,代码行数:4,代码来源:firebase.service.ts


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