Comments (4)
We've avoided the jQuery style ambiguous getter/setter throughout the Atom
codebase, for various reasons:
- It complicates the implementation of getters and setters by making the
same function serve two roles - It consumes the most likely name you would want to use for the actual
property being set. If I want to have a@badge
instance variable, I can't
because there's already a method namedbadge
.
On Tue, Aug 6, 2013 at 11:30 AM, David Graham [email protected]:
Getters and setters are uncommon in JavaScript. Instead of setBadge and
getBadge, can we have a badge() method that does this?badge: (text) ->
if text
# set the text
return theBadgeText()sets the badgedock.badge('42')
gets the badgetext = dock.badge()
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/46#issuecomment-22200340
.
from electron.
See https://github.com/atom/atom-shell/wiki/app#appdockbouncetype for the new dock API.
from electron.
Getters and setters are uncommon in JavaScript. Instead of setBadge and getBadge, can we have a badge() method that does this?
badge: (text) ->
if text
# set the text
return theBadgeText()
# sets the badge
dock.badge('42')
# gets the badge
text = dock.badge()
from electron.
We've never adopted the jquery one-function-as-getter-and-setter style in
Atom. We may be breaking JavaScript patterns, but I'd rather keep new API
methods consistent with the old ones. But if you think that is crazy feel
free to school @github/atom.
from electron.
Related Issues (20)
- [Bug]: install, RequestError: getaddrinfo ENOTFOUND HOT 1
- [Bug]: My Node Addon stopped working after version 20.3.8 HOT 1
- [Bug]: Maximizing a frameless window with background material (Mica) permanently breaks the window
- [Bug]: Custom protocol called many times with huge video files HOT 5
- [Bug]: app.getGPUInfo('complete') can't get videoDecodeAcceleratorSupportedProfile in some versions and platform HOT 1
- Reopen issue #40936 HOT 1
- [Bug]: 30.0.0-alpha7 and up crash on fullscreen with SIGSEGV HOT 9
- [Bug]: Font substituting while printing doesn't work on Windows Server 2016 HOT 2
- [Bug]: in my electron i am using multiple webview and i am not able to get which webview is in focus or even onclick event HOT 2
- feature request: allow build with enable_extensions=false HOT 2
- [Feature Request]: Possibility to set a default zoom level
- [Bug]: WARNING: AVCaptureDeviceTypeExternal is deprecated for Continuity Cameras. Please use AVCaptureDeviceTypeContinuityCamera and add NSCameraUseContinuityCameraDeviceType to your Info.plist. HOT 1
- [Bug]: macos v14 sonoma Previously developed electron, now white screen no content HOT 1
- [Bug]: process.exit does return and is not exiting synchronously when called in async function HOT 3
- [Bug]: process.env.npm_package_version cannot be read in product HOT 1
- [Bug]: ReadableStream is malformed when protocol.handle'd HOT 2
- [Bug]: Window Not Displaying Over Dock in Fullscreen Mode HOT 5
- [Bug]: IndexedDB corrupted and reset when no disk space
- electron应用在分辨率为1600*900的时候,出现亮线问题 HOT 10
- [Bug]: core dump on showing the app window via clicking tray icon HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron.