Working settings sync
This commit is contained in:
parent
9824d2ba31
commit
b87676d7b0
4 changed files with 12 additions and 5 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
|
@ -14,4 +14,11 @@ main.js
|
||||||
data.json
|
data.json
|
||||||
|
|
||||||
#vscode
|
#vscode
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
#buildfiles
|
||||||
|
settings.js
|
||||||
|
view/App.js
|
||||||
|
ReactView.js
|
||||||
|
settings.js
|
||||||
|
view.js
|
||||||
2
main.ts
2
main.ts
|
|
@ -21,7 +21,7 @@ export default class ExamplePlugin extends Plugin {
|
||||||
this.addSettingTab(new ExampleSettingsTab(this.app, this));
|
this.addSettingTab(new ExampleSettingsTab(this.app, this));
|
||||||
this.registerView(
|
this.registerView(
|
||||||
VIEW_TYPE_EXAMPLE,
|
VIEW_TYPE_EXAMPLE,
|
||||||
(leaf) => (this.view = new ExampleView(leaf))
|
(leaf) => (this.view = new ExampleView(leaf, this))
|
||||||
);
|
);
|
||||||
this.addRibbonIcon("dice", "Activate view", () => { //activate view
|
this.addRibbonIcon("dice", "Activate view", () => { //activate view
|
||||||
this.activateView();
|
this.activateView();
|
||||||
|
|
|
||||||
5
view.tsx
5
view.tsx
|
|
@ -9,9 +9,10 @@ export const VIEW_TYPE_EXAMPLE = "example-view"
|
||||||
|
|
||||||
export class ExampleView extends ItemView {
|
export class ExampleView extends ItemView {
|
||||||
plugin: ExamplePlugin;
|
plugin: ExamplePlugin;
|
||||||
constructor(leaf: WorkspaceLeaf) {
|
constructor(leaf: WorkspaceLeaf, plugin: ExamplePlugin) {
|
||||||
super(leaf)
|
super(leaf)
|
||||||
console.log(this.plugin.settings) }
|
this.plugin = plugin
|
||||||
|
}
|
||||||
|
|
||||||
getViewType() {
|
getViewType() {
|
||||||
return VIEW_TYPE_EXAMPLE
|
return VIEW_TYPE_EXAMPLE
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ class App extends React.Component<any,any> {
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(
|
.then(
|
||||||
result => {
|
result => {
|
||||||
console.log(result.data)
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isLoaded: true,
|
isLoaded: true,
|
||||||
tasks: result.data
|
tasks: result.data
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue