MCPcopy Create free account
hub / github.com/dashnowords/imfe / initMethods

Function initMethods

chapter17/vue.js:4848–4874  ·  view source on GitHub ↗
(vm, methods)

Source from the content-addressed store, hash-verified

4846 }
4847
4848 function initMethods (vm, methods) {
4849 var props = vm.$options.props;
4850 for (var key in methods) {
4851 {
4852 if (typeof methods[key] !== 'function') {
4853 warn(
4854 "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
4855 "Did you reference the function correctly?",
4856 vm
4857 );
4858 }
4859 if (props && hasOwn(props, key)) {
4860 warn(
4861 ("Method \"" + key + "\" has already been defined as a prop."),
4862 vm
4863 );
4864 }
4865 if ((key in vm) && isReserved(key)) {
4866 warn(
4867 "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
4868 "Avoid defining component methods that start with _ or $."
4869 );
4870 }
4871 }
4872 vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
4873 }
4874 }
4875
4876 function initWatch (vm, watch) {
4877 for (var key in watch) {

Callers 1

initStateFunction · 0.85

Calls 4

warnFunction · 0.85
hasOwnFunction · 0.85
isReservedFunction · 0.85
bindFunction · 0.85

Tested by

no test coverage detected