Skip to content

Instantly share code, notes, and snippets.

@ghyghoo8
ghyghoo8 / pull-to-refresh(android).js
Created July 4, 2012 07:57 — forked from jpurcell/pull-to-refresh(android).js
Tweetie-like pull to refresh and pull to load more. Note that it requries set heights for everything.
// This is the Android version of the Tweetie-like pull to refresh table:
// http://developer.appcelerator.com/blog/2010/05/how-to-create-a-tweetie-like-pull-to-refresh-table.html
var win = Ti.UI.currentWindow;
var alertDialog = Titanium.UI.createAlertDialog({
title: 'System Message',
buttonNames: ['OK']
});
var scrollView = Ti.UI.createScrollView({
package main
import (
//"bytes"
qrcode "github.com/skip2/go-qrcode"
"crypto/rand"
"fmt"
//"image"
//"image/png"
"os"
"runtime"
/**
* Promise 基于发布订阅的设计模式实现,then方法返回一个新的Promise,状态由上一个promise决定。
*/
Promise.prototype.then=function(onResolved,onRejected){
const self= this
return new Promise((resolve,reject)=>{
// 把相同的代码封装起来,并用try catch捕获错误
/*
像这种情况,使用者如果抛出错误,直接让下个promise也就是当前返回的promise状态为失败
then(res=>{