Merge pull request #15085 from ZoolWay/master

Fixed that GridStack object is obtained from jQuery.data() method
This commit is contained in:
Paul van Brenk
2017-03-21 17:08:19 -07:00
committed by GitHub
2 changed files with 9 additions and 4 deletions
+6 -2
View File
@@ -4,13 +4,17 @@
// Type definitions for Gridstack
// Project: http://troolee.github.io/gridstack.js/
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>, Ricky Blankenaufulland <https://github.com/ZoolWay/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
var options = <IGridstackOptions> {
float: true
};
var gridstack:GridStack = $(document).gridstack(options);
var element: JQuery = $(document).gridstack(options);
var gridstack: GridStack = $(document).data("gridstack");
var gsFromElement: GridStack = element.data("gridstack");
if (gridstack !== gsFromElement) throw Error('These should match!');
gridstack.addWidget("test", 1, 2, 3, 4, true);
gridstack.batchUpdate();
+3 -2
View File
@@ -1,10 +1,11 @@
// Type definitions for Gridstack
// Project: http://troolee.github.io/gridstack.js/
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>, Ricky Blankenaufulland <https://github.com/ZoolWay/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface JQuery {
gridstack (options: IGridstackOptions):GridStack
gridstack (options: IGridstackOptions): JQuery;
data(key: "gridstack"): GridStack;
}
interface GridStack {