Last active
April 16, 2020 18:50
-
-
Save lighth7015/4b76dde16854be3f7e96036975130926 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { IModel } from "~/store/Model"; | |
export default | |
class Application implements IModel { | |
public modelKey: string = "application"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { h } from 'preact'; | |
import ApplModel from '~/models/Application'; | |
import { Model, IModel } from '~/store/Model'; | |
export default | |
class Component extends React.Component { | |
constructor( | |
private model: Model<ApplModel> = new Model<ApplModel>(this) | |
) { | |
// Don't need to do anything here. | |
} | |
render() { | |
return <p>Testing.</p>; | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createContext } from "preact"; | |
const AppContext = createContext(); | |
export default AppContext; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'preact'; | |
export interface IModel { | |
public modelKey: string; | |
} | |
export default | |
class Model<T extends IModel> { | |
private typeInst: T = new T() => T; | |
private instance: React.Component; | |
constructor( | |
private instance: React.Component | |
) { } | |
find(): T { | |
// Find all models | |
} | |
where(memberName: string, memberValue: any ): any { | |
// Filter. | |
return this; | |
} | |
getInstance(): self { | |
return this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment