MCPcopy Index your code
hub / github.com/keepfool/vue-tutorials / register

Function register

06.Router/basic/js/vue.js:8149–8164  ·  view source on GitHub ↗

* Helper to register an event/watch callback. * * @param {Vue} vm * @param {String} action * @param {String} key * @param {Function|String|Object} handler * @param {Object} [options]

(vm, action, key, handler, options)

Source from the content-addressed store, hash-verified

8147 */
8148
8149 function register(vm, action, key, handler, options) {
8150 var type = typeof handler;
8151 if (type === 'function') {
8152 vm[action](key, handler, options);
8153 } else if (type === 'string') {
8154 var methods = vm.$options.methods;
8155 var method = methods && methods[handler];
8156 if (method) {
8157 vm[action](key, method, options);
8158 } else {
8159 'development' !== 'production' && warn('Unknown method: "' + handler + '" when ' + 'registering callback for ' + action + ': "' + key + '".', vm);
8160 }
8161 } else if (handler && type === 'object') {
8162 register(vm, action, key, handler.handler, handler);
8163 }
8164 }
8165
8166 /**
8167 * Setup recursive attached/detached calls

Callers 1

registerCallbacksFunction · 0.70

Calls 1

warnFunction · 0.70

Tested by

no test coverage detected