Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

v4 Observables #26

Closed
anton7r opened this issue Sep 14, 2019 · 5 comments
Closed

v4 Observables #26

anton7r opened this issue Sep 14, 2019 · 5 comments
Labels
feature request New feature or request

Comments

@anton7r
Copy link
Owner

anton7r commented Sep 14, 2019

Ive found some problems with some of the systems that we've got in place, quite easy to fix but also time consuming.

"global" and component specific variables should be a part of the fix

@anton7r anton7r added the feature request New feature or request label Sep 14, 2019
@anton7r
Copy link
Owner Author

anton7r commented Sep 14, 2019

API Proposal

// Defining watchable
a7.watchable("name", "value");

// API for Accessing values

a7.watchable("name") //Returns the value of name 


//watching for changes
a7.watch("name", function(newValue){
    // Executes code when value of "name" changes
})

And also these would be accessable from anyScope

@anton7r
Copy link
Owner Author

anton7r commented Sep 14, 2019

alternative

// Defining watchable
a7.watchable("name").set;

// API for Accessing values

a7.watchable("name").val //Returns the value of name 


//watching for changes
a7.watchable("name").onChange(function(newValue){
    // Executes code when value of "name" changes
})

@anton7r
Copy link
Owner Author

anton7r commented Sep 15, 2019

or

//Defining
var a = new a7.watchable

//Setting
a.set("Example")
 
// getting
a.value

// listening for changes
a.onChange(function(newValue){
    console.log(newValue)
})

@anton7r anton7r changed the title v4 "global" watchable variables and component specific v4 Observables Sep 16, 2019
@anton7r
Copy link
Owner Author

anton7r commented Sep 16, 2019

yes i was talking about observables

@anton7r
Copy link
Owner Author

anton7r commented Sep 20, 2019

added

@anton7r anton7r closed this as completed Sep 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant