Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Indexed Database API (http://www.w3.org/TR/IndexedDB). #319

Merged
merged 8 commits into from Jan 25, 2013
50 changes: 50 additions & 0 deletions src/Libraries/Web/Html/Data/IndexedDB/DBCursor.cs
@@ -0,0 +1,50 @@
using System;
using System.Runtime.CompilerServices;

namespace System.Html.Data.IndexedDB {

[ScriptIgnoreNamespace]
[ScriptImport]
public class DBCursor {

protected DBCursor() {
}

[ScriptField]
public object Source {
get { return null; }
}

[ScriptField]
public string Direction {
get { return null; }
}

[ScriptField]
public object Key {
get { return null; }
}

[ScriptField]
public object PrimaryKey {
get { return null; }
}

public DBRequest Update(object value) {
return null;
}

public void Advance(long count) {
}

public void Continue() {
}

public void Continue(object key) {
}

public DBRequest Delete(object value) {
return null;
}
}
}
20 changes: 20 additions & 0 deletions src/Libraries/Web/Html/Data/IndexedDB/DBCursorWithValue.cs
@@ -0,0 +1,20 @@
using System;
using System.Runtime.CompilerServices;

namespace System.Html.Data.IndexedDB {

[ScriptIgnoreNamespace]
[ScriptImport]
public class DBCursorWithValue : DBCursor {

private DBCursorWithValue() {
}

[ScriptField]
public object Value {
get {
return null;
}
}
}
}
68 changes: 68 additions & 0 deletions src/Libraries/Web/Html/Data/IndexedDB/DBDatabase.cs
@@ -0,0 +1,68 @@
using System;
using System.Runtime.CompilerServices;

namespace System.Html.Data.IndexedDB {

[ScriptIgnoreNamespace]
[ScriptImport]
public sealed class DBDatabase : DBEventTarget {

private DBDatabase() {
}

[ScriptField]
public string Name {
get { return default(string); }
}

[ScriptField]
public long Version {
get { return default(long); }
}

[ScriptField]
public string[] ObjectStoreNames {
get { return default(string[]); }
}

public DBObjectStore CreateObjectStore(string name) {
return default(DBObjectStore);
}

public DBObjectStore CreateObjectStore(string name, DBObjectStoreParameters optionalParameters) {
return default(DBObjectStore);
}

public void DeleteObjectStore(string name) {
}

public DBTransaction Transaction(string[] storenames) {
return default(DBTransaction);
}

public DBTransaction Transaction(string[] storenames, string mode) {
return default(DBTransaction);
}

public void Close() {
}

[ScriptName("onabort")]
public DBDatabaseCallback OnAbort;

[ScriptName("onerror")]
public DBDatabaseCallback OnError;

[ScriptName("onversionchange")]
public DBDatabaseVersionChangeCallback OnVersionChange;
}

[ScriptIgnoreNamespace]
[ScriptImport]
public delegate void DBDatabaseCallback(DBEvent<DBDatabase> e);

[ScriptIgnoreNamespace]
[ScriptImport]
public delegate void DBDatabaseVersionChangeCallback(DBVersionChangeEvent<DBDatabase> e);

}
36 changes: 36 additions & 0 deletions src/Libraries/Web/Html/Data/IndexedDB/DBEvent.cs
@@ -0,0 +1,36 @@
using System;
using System.Runtime.CompilerServices;

namespace System.Html.Data.IndexedDB {

[ScriptIgnoreNamespace]
[ScriptImport]
public class DBEvent<T> {

[ScriptField]
public string Type {
get { return null; }
}

[ScriptField]
public T Target {
get { return default(T); }
}
}

[ScriptIgnoreNamespace]
[ScriptImport]
public class DBVersionChangeEvent<T> : DBEvent<T> {

[ScriptField]
public long OldVersion {
get { return default(long); }
}

[ScriptField]
public long NewVersion {
get { return default(long); }
}
}

}
26 changes: 26 additions & 0 deletions src/Libraries/Web/Html/Data/IndexedDB/DBEventTarget.cs
@@ -0,0 +1,26 @@
using System;
using System.Runtime.CompilerServices;

namespace System.Html.Data.IndexedDB {

[ScriptIgnoreNamespace]
[ScriptImport]
public class DBEventTarget {

public void AddEventListener<T>(string type, Action<T> listener) {
}

public void AddEventListener<T>(string type, Action<T> listener, bool useCapture) {
}

public void RemoveEventListener<T>(string type, Action<T> listener) {
}

public void RemoveEventListener<T>(string type, Action<T> listener, bool useCapture) {
}

public bool DispatchEvent<T>(DBEvent<T> e) {
return false;
}
}
}
29 changes: 29 additions & 0 deletions src/Libraries/Web/Html/Data/IndexedDB/DBFactory.cs
@@ -0,0 +1,29 @@
using System;
using System.Runtime.CompilerServices;

namespace System.Html.Data.IndexedDB {

[ScriptIgnoreNamespace]
[ScriptImport]
public sealed class DBFactory {

private DBFactory() {
}

public DBOpenDBRequest Open(string name) {
return null;
}

public DBOpenDBRequest Open(string name, long version) {
return null;
}

public DBOpenDBRequest DeleteDatabase(string name) {
return null;
}

public short Cmp(object first, object last) {
return default(short);
}
}
}
78 changes: 78 additions & 0 deletions src/Libraries/Web/Html/Data/IndexedDB/DBIndex.cs
@@ -0,0 +1,78 @@
using System;
using System.Runtime.CompilerServices;

namespace System.Html.Data.IndexedDB {

[ScriptIgnoreNamespace]
[ScriptImport]
public sealed class DBIndex {

private DBIndex() {
}

[ScriptField]
public string Name {
get { return default(string); }
}

[ScriptField]
public DBObjectStore ObjectStore {
get { return default(DBObjectStore); }
}

[ScriptField]
public string KeyPath {
get { return default(string); }
}

[ScriptField]
public bool MultiEntry {
get { return default(bool); }
}

[ScriptField]
public bool Unique {
get { return default(bool); }
}

public DBRequest OpenCursor() {
return null;
}

public DBRequest OpenCursor(object range) {
return null;
}

public DBRequest OpenCursor(object range, string direction) {
return null;
}

public DBRequest OpenKeyCursor() {
return null;
}

public DBRequest OpenKeyCursor(object range) {
return null;
}

public DBRequest OpenKeyCursor(object range, string direction) {
return null;
}

public DBRequest Get(object key) {
return null;
}

public DBRequest GetKey(object key) {
return null;
}

public DBRequest Count() {
return null;
}

public DBRequest Count(object key) {
return null;
}
}
}
29 changes: 29 additions & 0 deletions src/Libraries/Web/Html/Data/IndexedDB/DBIndexParameters.cs
@@ -0,0 +1,29 @@
using System;
using System.Runtime.CompilerServices;

namespace System.Html.Data.IndexedDB {

[ScriptIgnoreNamespace]
[ScriptImport]
[ScriptName("Object")]
public sealed class DBIndexParameters {

[ScriptField]
public bool Unique {
get {
return false;
}
set {
}
}

[ScriptField]
public bool MultiEntry {
get {
return false;
}
set {
}
}
}
}