Merge pull request #1215 from cmgustavo/bug/02-performance

Trying to improve Copay performance
This commit is contained in:
Matias Alejo Garcia 2014-08-29 19:55:58 -03:00
commit 3339c2d6a7
4 changed files with 20 additions and 21 deletions

View File

@ -79,6 +79,8 @@ module.exports = function(grunt) {
concat: {
vendors: {
src: [
'lib/mousetrap/mousetrap.min.js',
'js/shell.js', // shell must be loaded before moment due to the way moment loads in a commonjs env
'lib/moment/min/moment.min.js',
'lib/qrcode-generator/js/qrcode.js',
'lib/peer.js',
@ -90,7 +92,8 @@ module.exports = function(grunt) {
'lib/socket.io-client/socket.io.js',
'lib/sjcl.js',
'lib/ios-imagefile-megapixel/megapix-image.js',
'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js'
'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js',
'lib/zeroclipboard/ZeroClipboard.min.js'
],
dest: 'lib/vendors.js'
},
@ -113,7 +116,9 @@ module.exports = function(grunt) {
'js/filters.js',
'js/routes.js',
'js/services/*.js',
'js/controllers/*.js'
'js/controllers/*.js',
'js/mobile.js', // PLACEHOLDER: CORDOVA SRIPT
'js/init.js'
],
dest: 'js/copayMain.js'
}
@ -136,7 +141,9 @@ module.exports = function(grunt) {
},
prod: {
files: {
'js/copayMain.js': ['js/copayMain.js']
'js/copayMain.js': ['js/copayMain.js'],
'lib/angularjs-all.js': ['lib/angularjs-all.js'],
'lib/vendors.js': ['lib/vendors.js']
}
}
}

View File

@ -21,7 +21,7 @@
"angular-moment": "~0.7.1",
"socket.io-client": ">=1.0.0",
"mousetrap": "1.4.6",
"zeroclipboard": "~2.1.6",
"zeroclipboard": "~1.3.5",
"ng-idle": "*"
},
"resolutions": {

View File

@ -53,21 +53,12 @@
</div>
</div>
<script src="lib/mousetrap/mousetrap.min.js"></script>
<!-- shell must be loaded before moment due to the way moment loads in a commonjs env -->
<script src="js/shell.js"></script>
<script src="lib/vendors.js"></script>
<script src="lib/zeroclipboard/dist/ZeroClipboard.min.js"></script>
<script src="lib/angularjs-all.js"></script>
<script src="config.js"></script>
<script src="js/copayBundle.js"></script>
<script src="js/copayMain.js"></script>
<!-- PLACEHOLDER: CORDOVA SRIPT -->
<script src="js/mobile.js"></script>
<script src="js/init.js"></script>
</body>
</html>

View File

@ -257,7 +257,7 @@ angular.module('copayApp.directives')
})
.directive('clipCopy', function() {
ZeroClipboard.config({
moviePath: '/lib/zeroclipboard/dist/ZeroClipboard.swf',
moviePath: '/lib/zeroclipboard/ZeroClipboard.swf',
trustedDomains: ['*'],
allowScriptAccess: 'always',
forceHandCursor: true
@ -271,12 +271,13 @@ angular.module('copayApp.directives')
link: function(scope, elm) {
var client = new ZeroClipboard(elm);
client.on('ready', function(event) {
client.on('copy', function(event) {
event.clipboardData.setData('text/plain', scope.clipCopy);
});
client.on('load', function(client) {
client.on('aftercopy', function(event) {
client.on('datarequested', function(client) {
client.setText(scope.clipCopy);
} );
client.on('complete', function(client, args) {
elm.removeClass('btn-copy').addClass('btn-copied').html('Copied!');
setTimeout(function() {
elm.addClass('btn-copy').removeClass('btn-copied').html('');
@ -284,10 +285,10 @@ angular.module('copayApp.directives')
});
});
client.on('error', function(event) {
console.log('ZeroClipboard error of type "' + event.name + '": ' + event.message);
client.on('wrongflash noflash', function() {
ZeroClipboard.destroy();
});
}
};
});