File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 82
82
83
83
* 'cancel' : triggered on [ esc] keydown
84
84
85
+ * 'error' : called if the browser doesn't support canvases and the plugin didn't initialize as a result
86
+
85
87
The scope (this) of each hook function is the current Knob instance (refer to the demo code).
86
88
87
89
Example
Original file line number Diff line number Diff line change 106
106
draw : null , // function () {}
107
107
change : null , // function (value) {}
108
108
cancel : null , // function () {}
109
- release : null // function (value) {}
109
+ release : null , // function (value) {}
110
+ error : null // function () {}
110
111
} , this . o
111
112
) ;
112
113
151
152
this . $c = $ ( '<canvas width="' +
152
153
this . o . width + 'px" height="' +
153
154
this . o . height + 'px"></canvas>' ) ;
154
- this . c = this . $c [ 0 ] . getContext ( "2d" ) ;
155
+
156
+ this . c = this . $c [ 0 ] . getContext ? this . $c [ 0 ] . getContext ( '2d' ) : null ;
157
+
158
+ if ( ! this . c ) {
159
+ this . o . error && this . o . error ( ) ;
160
+ return ;
161
+ }
155
162
156
163
this . $
157
164
. wrap ( $ ( '<div style="' + ( this . o . inline ? 'display:inline;' : '' ) +
You can’t perform that action at this time.
0 commit comments