OLD | NEW |
| (Empty) |
1 dart_library.library('dart/web_sql', null, /* Imports */[ | |
2 'dart/_runtime', | |
3 'dart/core', | |
4 'dart/_interceptors', | |
5 'dart/html', | |
6 'dart/_metadata', | |
7 'dart/_js_helper', | |
8 'dart/html_common', | |
9 'dart/collection' | |
10 ], /* Lazy imports */[ | |
11 ], function(exports, dart, core, _interceptors, html, _metadata, _js_helper, htm
l_common, collection) { | |
12 'use strict'; | |
13 let dartx = dart.dartx; | |
14 const SqlStatementCallback = dart.typedef('SqlStatementCallback', () => dart.f
unctionType(dart.void, [SqlTransaction, SqlResultSet])); | |
15 const SqlStatementErrorCallback = dart.typedef('SqlStatementErrorCallback', ()
=> dart.functionType(dart.void, [SqlTransaction, SqlError])); | |
16 const SqlTransactionCallback = dart.typedef('SqlTransactionCallback', () => da
rt.functionType(dart.void, [SqlTransaction])); | |
17 const SqlTransactionErrorCallback = dart.typedef('SqlTransactionErrorCallback'
, () => dart.functionType(dart.void, [SqlError])); | |
18 dart.defineExtensionNames([ | |
19 'changeVersion', | |
20 'readTransaction', | |
21 'transaction', | |
22 'version' | |
23 ]); | |
24 class SqlDatabase extends _interceptors.Interceptor { | |
25 static _() { | |
26 dart.throw(new core.UnsupportedError("Not supported")); | |
27 } | |
28 static get supported() { | |
29 return !!window.openDatabase; | |
30 } | |
31 get [dartx.version]() { | |
32 return this.version; | |
33 } | |
34 [dartx.changeVersion](oldVersion, newVersion, callback, errorCallback, succe
ssCallback) { | |
35 return this.changeVersion(oldVersion, newVersion, callback, errorCallback,
successCallback); | |
36 } | |
37 [dartx.readTransaction](callback, errorCallback, successCallback) { | |
38 return this.readTransaction(callback, errorCallback, successCallback); | |
39 } | |
40 [dartx.transaction](callback, errorCallback, successCallback) { | |
41 return this.transaction(callback, errorCallback, successCallback); | |
42 } | |
43 } | |
44 dart.setSignature(SqlDatabase, { | |
45 constructors: () => ({_: [SqlDatabase, []]}), | |
46 methods: () => ({ | |
47 [dartx.changeVersion]: [dart.void, [core.String, core.String], [SqlTransac
tionCallback, SqlTransactionErrorCallback, html.VoidCallback]], | |
48 [dartx.readTransaction]: [dart.void, [SqlTransactionCallback], [SqlTransac
tionErrorCallback, html.VoidCallback]], | |
49 [dartx.transaction]: [dart.void, [SqlTransactionCallback], [SqlTransaction
ErrorCallback, html.VoidCallback]] | |
50 }) | |
51 }); | |
52 SqlDatabase[dart.metadata] = () => [dart.const(new _metadata.DocsEditable()),
dart.const(new _metadata.DomName('Database')), dart.const(new _metadata.Supporte
dBrowser(_metadata.SupportedBrowser.CHROME)), dart.const(new _metadata.Supported
Browser(_metadata.SupportedBrowser.SAFARI)), dart.const(new _metadata.Experiment
al()), dart.const(new _metadata.Experimental()), dart.const(new _js_helper.Nativ
e("Database"))]; | |
53 dart.registerExtension(dart.global.Database, SqlDatabase); | |
54 dart.defineExtensionNames([ | |
55 'code', | |
56 'message' | |
57 ]); | |
58 class SqlError extends _interceptors.Interceptor { | |
59 static _() { | |
60 dart.throw(new core.UnsupportedError("Not supported")); | |
61 } | |
62 get [dartx.code]() { | |
63 return this.code; | |
64 } | |
65 get [dartx.message]() { | |
66 return this.message; | |
67 } | |
68 } | |
69 dart.setSignature(SqlError, { | |
70 constructors: () => ({_: [SqlError, []]}) | |
71 }); | |
72 SqlError[dart.metadata] = () => [dart.const(new _metadata.DocsEditable()), dar
t.const(new _metadata.DomName('SQLError')), dart.const(new _metadata.Experimenta
l()), dart.const(new _js_helper.Native("SQLError"))]; | |
73 SqlError.CONSTRAINT_ERR = 6; | |
74 SqlError.DATABASE_ERR = 1; | |
75 SqlError.QUOTA_ERR = 4; | |
76 SqlError.SYNTAX_ERR = 5; | |
77 SqlError.TIMEOUT_ERR = 7; | |
78 SqlError.TOO_LARGE_ERR = 3; | |
79 SqlError.UNKNOWN_ERR = 0; | |
80 SqlError.VERSION_ERR = 2; | |
81 dart.registerExtension(dart.global.SQLError, SqlError); | |
82 dart.defineExtensionNames([ | |
83 'insertId', | |
84 'rows', | |
85 'rowsAffected' | |
86 ]); | |
87 class SqlResultSet extends _interceptors.Interceptor { | |
88 static _() { | |
89 dart.throw(new core.UnsupportedError("Not supported")); | |
90 } | |
91 get [dartx.insertId]() { | |
92 return this.insertId; | |
93 } | |
94 get [dartx.rows]() { | |
95 return this.rows; | |
96 } | |
97 get [dartx.rowsAffected]() { | |
98 return this.rowsAffected; | |
99 } | |
100 } | |
101 dart.setSignature(SqlResultSet, { | |
102 constructors: () => ({_: [SqlResultSet, []]}) | |
103 }); | |
104 SqlResultSet[dart.metadata] = () => [dart.const(new _metadata.DocsEditable()),
dart.const(new _metadata.DomName('SQLResultSet')), dart.const(new _metadata.Exp
erimental()), dart.const(new _js_helper.Native("SQLResultSet"))]; | |
105 dart.registerExtension(dart.global.SQLResultSet, SqlResultSet); | |
106 const _item_1 = Symbol('_item_1'); | |
107 dart.defineExtensionNames([ | |
108 'length', | |
109 'get', | |
110 'set', | |
111 'length', | |
112 'first', | |
113 'last', | |
114 'single', | |
115 'elementAt', | |
116 'item' | |
117 ]); | |
118 class SqlResultSetRowList extends dart.mixin(_interceptors.Interceptor, collec
tion.ListMixin$(core.Map), html.ImmutableListMixin$(core.Map)) { | |
119 static _() { | |
120 dart.throw(new core.UnsupportedError("Not supported")); | |
121 } | |
122 get [dartx.length]() { | |
123 return this.length; | |
124 } | |
125 [dartx.get](index) { | |
126 if (index >>> 0 !== index || index >= this[dartx.length]) dart.throw(core.
RangeError.index(index, this)); | |
127 return this[dartx.item](index); | |
128 } | |
129 [dartx.set](index, value) { | |
130 dart.throw(new core.UnsupportedError("Cannot assign element of immutable L
ist.")); | |
131 return value; | |
132 } | |
133 set [dartx.length](value) { | |
134 dart.throw(new core.UnsupportedError("Cannot resize immutable List.")); | |
135 } | |
136 get [dartx.first]() { | |
137 if (dart.notNull(this[dartx.length]) > 0) { | |
138 return this[0]; | |
139 } | |
140 dart.throw(new core.StateError("No elements")); | |
141 } | |
142 get [dartx.last]() { | |
143 let len = this[dartx.length]; | |
144 if (dart.notNull(len) > 0) { | |
145 return this[dart.notNull(len) - 1]; | |
146 } | |
147 dart.throw(new core.StateError("No elements")); | |
148 } | |
149 get [dartx.single]() { | |
150 let len = this[dartx.length]; | |
151 if (len == 1) { | |
152 return this[0]; | |
153 } | |
154 if (len == 0) dart.throw(new core.StateError("No elements")); | |
155 dart.throw(new core.StateError("More than one element")); | |
156 } | |
157 [dartx.elementAt](index) { | |
158 return this[dartx.get](index); | |
159 } | |
160 [dartx.item](index) { | |
161 return html_common.convertNativeToDart_Dictionary(this[_item_1](index)); | |
162 } | |
163 [_item_1](index) { | |
164 return this.item(index); | |
165 } | |
166 } | |
167 SqlResultSetRowList[dart.implements] = () => [core.List$(core.Map)]; | |
168 dart.setSignature(SqlResultSetRowList, { | |
169 constructors: () => ({_: [SqlResultSetRowList, []]}), | |
170 methods: () => ({ | |
171 [dartx.get]: [core.Map, [core.int]], | |
172 [dartx.set]: [dart.void, [core.int, core.Map]], | |
173 [dartx.elementAt]: [core.Map, [core.int]], | |
174 [dartx.item]: [core.Map, [core.int]], | |
175 [_item_1]: [dart.dynamic, [dart.dynamic]] | |
176 }) | |
177 }); | |
178 SqlResultSetRowList[dart.metadata] = () => [dart.const(new _metadata.DocsEdita
ble()), dart.const(new _metadata.DomName('SQLResultSetRowList')), dart.const(new
_metadata.Experimental()), dart.const(new _js_helper.Native("SQLResultSetRowLis
t"))]; | |
179 dart.registerExtension(dart.global.SQLResultSetRowList, SqlResultSetRowList); | |
180 dart.defineExtensionNames([ | |
181 'executeSql' | |
182 ]); | |
183 class SqlTransaction extends _interceptors.Interceptor { | |
184 static _() { | |
185 dart.throw(new core.UnsupportedError("Not supported")); | |
186 } | |
187 [dartx.executeSql](sqlStatement, arguments$, callback, errorCallback) { | |
188 return this.executeSql(sqlStatement, arguments$, callback, errorCallback); | |
189 } | |
190 } | |
191 dart.setSignature(SqlTransaction, { | |
192 constructors: () => ({_: [SqlTransaction, []]}), | |
193 methods: () => ({[dartx.executeSql]: [dart.void, [core.String, core.List$(co
re.Object)], [SqlStatementCallback, SqlStatementErrorCallback]]}) | |
194 }); | |
195 SqlTransaction[dart.metadata] = () => [dart.const(new _metadata.DocsEditable()
), dart.const(new _metadata.DomName('SQLTransaction')), dart.const(new _metadata
.SupportedBrowser(_metadata.SupportedBrowser.CHROME)), dart.const(new _metadata.
SupportedBrowser(_metadata.SupportedBrowser.SAFARI)), dart.const(new _metadata.E
xperimental()), core.deprecated, dart.const(new _js_helper.Native("SQLTransactio
n"))]; | |
196 dart.registerExtension(dart.global.SQLTransaction, SqlTransaction); | |
197 // Exports: | |
198 exports.SqlStatementCallback = SqlStatementCallback; | |
199 exports.SqlStatementErrorCallback = SqlStatementErrorCallback; | |
200 exports.SqlTransactionCallback = SqlTransactionCallback; | |
201 exports.SqlTransactionErrorCallback = SqlTransactionErrorCallback; | |
202 exports.SqlDatabase = SqlDatabase; | |
203 exports.SqlError = SqlError; | |
204 exports.SqlResultSet = SqlResultSet; | |
205 exports.SqlResultSetRowList = SqlResultSetRowList; | |
206 exports.SqlTransaction = SqlTransaction; | |
207 }); | |
OLD | NEW |