10.02 - facades as convenience methods.js

来自「JS设计模式源代码」· JavaScript 代码 · 共 42 行

JS
42
字号
function a(x) {  // do stuff here...}function b(y) {  // do stuff here...}function ab(x, y) {  a(x);  b(y);}var DED = window.DED || {};DED.util = {  stopPropagation: function(e) {    if (ev.stopPropagation) {      // W3 interface      e.stopPropagation();    }     else {      // IE's interface      e.cancelBubble = true;    }  },  preventDefault: function(e) {    if (e.preventDefault) {      // W3 interface      e.preventDefault();    }     else {      // IE's interface      e.returnValue = false;    }  },  /* our convenience method */  stopEvent: function(e) {    DED.util.stopPropagation(e);    DED.util.preventDefault(e);  }};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?