문제

I have 2 classes:

$.widget('blueimp.fileupload', {
    a: function  {}
})

$.widget('blueimpUI.fileupload', $.blueimp.fileupload, {
    b: function  {}
})

I want to replace my first two functions with a single class.

Function b works but function a doesn't. Why?

$.widget('blueimpUI.fileupload', $.blueimpUI.fileupload, {
    a: function  {},
    b: function  {}
})
도움이 되었습니까?

해결책

Something like this might work better:

$.widget('blueimpUI.fileupload', {
    fileupload: $.blueimp.fileupload, 
    a: function  {},
    b: function  {}
});

다른 팁

It's not quite clear what you're trying to do but I believe the $.widget method takes two arguments as explained in this documentation:

jquery.ui.widget.js provides a factory method to create widget classes. The signature is $.widget(String name, Options prototype)

Therefore, the code with function b probably does not work due to incorrect syntax.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top