Browse Source

implement Util.both

master
ansuz 1 year ago
parent
commit
bcbe561bbf
1 changed files with 8 additions and 0 deletions
  1. 8
      www/common/common-util.js

8
www/common/common-util.js

@ -1,6 +1,14 @@
(function (window) {
var Util = {};
Util.both = function (pre, post) {
if (typeof(post) !== 'function') { post = function (x) { return x; }; }
return function () {
pre.apply(null, arguments);
return post.apply(null, arguments);
};
};
Util.tryParse = function (s) {
try { return JSON.parse(s); } catch (e) { return;}
};

Loading…
Cancel
Save