PureMVC
Home
About
Code
Docs
FAQ
Forums
News
Showcase
Contact
Jobs
Welcome,
Guest
. Please
login
or
register
.
June 18, 2013, 11:34:37 PM
News:
ATTENTION: Spambots must die! Humans must visit
http://contact.futurescale.com
to request forum access.
PureMVC Architects Lounge
PureMVC Manifold
Port to JavaScript
Native JS Branch
(Moderator:
davidfoley
)
Native Javascript port?
Pages:
1
[
2
]
« previous
next »
Author
Topic: Native Javascript port? (Read 4038 times)
Tekool
Sr. Member
Posts: 196
Re: Native Javascript port?
«
Reply #15 on:
February 01, 2012, 02:21:46 PM »
Excellent! Thank you Tony.
Just a remark, I saw that you are you using "Object.prototype.toString.call(this.onComplete)" instead of typeof this.onComplete == "function" ? Is this something related to ExtJS?
Logged
Tony DeFusco
Newbie
Posts: 9
Re: Native Javascript port?
«
Reply #16 on:
February 01, 2012, 02:48:38 PM »
Hi Frederic:
Thanks for the code review. I had originally ported this utility using ExtJS which had a function I was using called Ext.isFunction(). When I ported the utility to native JS multi-core and removed the ExtJS dependencies, I had to come up with a reliable cross-browser alternative to Ext.isFunction(). That bit of code
(myFnVar && Object.prototype.toString.call(myFnVar) === '[object Function]')
is what I came up with. I found that Object's toString() function identified an object variable to be a function in the form of the string "[object Function]" consistently across browsers.
If the approach to determine if an object variable is a function using JavaScript's typeof operator works reliably & consistently across browsers, then I am all for going with that approach instead.
Cheers.
Tony
Logged
Tekool
Sr. Member
Posts: 196
Re: Native Javascript port?
«
Reply #17 on:
February 01, 2012, 02:57:01 PM »
From what I know and have tested across browsers: typeof this.onComplete == "function" is safe. This said, with JavaScript…who knows, there could be a better solution for this or someone to tell that something else is best to do.
Logged
puremvc
Global Moderator
Hero Member
Posts: 2791
Re: Native Javascript port?
«
Reply #18 on:
February 01, 2012, 04:41:36 PM »
Quote
But I think it would be better to first have an human readable documentation for the Native port explaining "willing", "how to" and at least an "Hello World example".
Definitely more docs are in order (beyond the API docs).
The Hello World example is a thorny problem, because, as I understand it, everyone uses some UI framework or other.
For the Native port, I imagine that to be PureMVC, JavaScript, the DOM and nothing else. Something simple like taking user input from a field, then reversing it in a command, and displaying it in a label. Or maybe a calculator that uses transient Proxys to store values as you enter expressions. Basically something that gets all the major actors working at a task.
For illustrative purposes, that demo should be written both with pure JS for creating the classes, and also using the puremvc.define() method. That should show with little distraction the difference between rolling your own JS classes or using the PureMVC built ins.
Ideally, the next level would be to do that demo using Ext, and JQuery, but for components only. The PureMVC classes would be written with puremvc.define(). If this could be a single demo could be done with both JQuery and Ext components, it would be even better. We'd see a mediator for a JQuery component and one for a Ext component, in the same PureMVC app but not governing how the app itself is written, only the components and how the mediators communicate with the components.
Then the next level is the demo done with JQuery and all PureMVC classes are done in one demo with JQuery style, another with Objs, another with Ext, etc. This would show us how we can use PureMVC native without imposing any style on how you write your classes, but the actors and their roles are all the same.
-=Cliff>
Logged
zermattchris
Full Member
Posts: 35
Re: Native Javascript port?
«
Reply #19 on:
February 02, 2012, 05:16:25 AM »
Sounds like a great plan of attack Cliff.
Logged
davidfoley
Moderator
Newbie
Posts: 8
Re: Native Javascript port?
«
Reply #20 on:
February 02, 2012, 01:20:45 PM »
Hey guys, apologies for my absence of late, I'll be more involved day to day moving forward. Just a quick note in relation to type checking with typeof and Object.prototype.toString.
Object.prototype.toString called on an instance of any Native class will return the name of that class in the form [object ClassName] where ClassName can be an instance of any Native JavaScript class (String, Boolean, Number, Function, Array, Object, Date, RegExp, Error(s)). In all other cases, it will return [object Object] (except for the case of host object in MSIE, which return [object]). One useful benefit is that while instanceof will fail for native instances referenced from another global scope (such as an iFrames global scope), calling the native Object.prototype.toString method on an instance of a Native object from another scope is consistent across all browsers.
All that said, generally, its preferable (and fully supported by all JavaScript interpreters) to use the 'function' === typeof object idiom that Frederic suggested, unless of course, like Ext's authors, you want to support the edge case of using a Function instance that was created in another global context. I'm not sure here is the right place to discuss the fine detail of JavaScript, but its naturally going to crop up... I'm wondering if we compile and point to a list of articles that we can defer these kind of questions to.
Any suggestions as to where we could house that or what we should link to? I just want to keep some kind of separation of concerns between JavaScript in the large and how to use PureMvc- maybe a dedicated thread focused on a few pertinent JavaScript gotchas that people may encounter when using the library?
Anyhow, here's an article comparing Object.prototype.toString to typeof :
http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
«
Last Edit: February 02, 2012, 01:33:00 PM by davidfoley
»
Logged
Tekool
Sr. Member
Posts: 196
Re: Native Javascript port?
«
Reply #21 on:
February 02, 2012, 01:41:33 PM »
David, can you confirm that I can continue my job on the PureMVC StateMachine?
Logged
davidfoley
Moderator
Newbie
Posts: 8
Re: Native Javascript port?
«
Reply #22 on:
February 02, 2012, 02:10:24 PM »
Hey Frederic, let's coordinate offline. The forums shouldn't be used for project planning if you're ok with that? Ping you tomorrow, thanks.
Logged
Tekool
Sr. Member
Posts: 196
Re: Native Javascript port?
«
Reply #23 on:
February 02, 2012, 02:11:56 PM »
I'm currently (I mean now) working on it. I need to know if I'm losing my time.
Logged
davidfoley
Moderator
Newbie
Posts: 8
Re: Native Javascript port?
«
Reply #24 on:
February 02, 2012, 02:28:13 PM »
Em, you do know I ported two days ago, right? How about we work together? This isn't a one man show! Entirely up to you - what would really help out would be the devisement of some unit tests if your interested? But I will ask you once more to direct project planning related questions away from the forum of you don't mind? I would really appreciate keeping the topics focused on helping end users and discussing use cases and their resolution. Thanks a million.
Logged
Tekool
Sr. Member
Posts: 196
Re: Native Javascript port?
«
Reply #25 on:
February 02, 2012, 02:51:30 PM »
I don't think project planning related questions must be get out the forums. Let's open a thread for this specific utility or kind of subjects if you want, but we can't e-mail the whole PureMVC community every time we want to talk about a project. Forums are specifically made for this in my opinion.
This said, I don't understand exactly what you mean, you already have finished to port the FSM? I just started with Unit Tests on my project. My plan was also to make a StopWatch demo when publishing the JavaScript utility. There also the multicore port of the utility to do.
What I don't understand is that I started 4 projects on
my Github
that are planned for long :
JQuery and Employee Admin (done)
JQuery Mobile and Employee Admin (done)
State Machine (current work)
Pipes (even not started)
I told about it to Cliff and LinkedIN group last month, Cliff just told me yesterday that you are exactly planning State Machine and Pipes. I'm working with and for PureMVC community for five years now and we never had this problem before. I'm kind of sceptic on what happens there.
I told Cliff that I even not have started with Pipes utility so anybody willing to work on it is welcome. But I really don't want to work for nothing on the StateMachine. I participate for my own fun and the community benefit I don't want to have problems because of this.
«
Last Edit: February 02, 2012, 02:58:11 PM by Tekool
»
Logged
puremvc
Global Moderator
Hero Member
Posts: 2791
Re: Native Javascript port?
«
Reply #26 on:
February 02, 2012, 03:43:48 PM »
David, Frederic,
I'm sorry, I must be at the source of these problems. David said he had a few hours to kill and was thinking of doing the StateMachine. I
honestly
do not remember Frederic saying he was planning to port the StateMachine and Pipes to work the Native port. I knew Frederic was working on things for the Objs port, but I did not know he had anything planned so far for Native.
So it was my bad. Please don't either of you take offense, I think everyone wants the same thing here, which is a proven set of useful tools for doing things.
I don't think it would be a bad idea for someone to post in the PureMVC JS / Demos and Utils board when they're thinking about porting something or doing a demo. That's where most people in the world who'll pitch in to help should logically look. And a public record of how and why things get done has thus far proven to be a good thing for the project.
Again, a complete failure to coordinate on my part, and I hope you'll both forgive me. I'd hate to have two very talented folks who really understand this stuff to have bad feelings because I dropped the ball.
-=Cliff>
«
Last Edit: February 02, 2012, 03:45:51 PM by puremvc
»
Logged
davidfoley
Moderator
Newbie
Posts: 8
Re: Native Javascript port?
«
Reply #27 on:
February 02, 2012, 03:58:49 PM »
Hi Frederic,
you're obviously very passionate about this, and there is an obvious lack of communication happening.
Quote
we can't e-mail the whole PureMVC community every time we want to talk about a project
That is precisely what I am trying to avoid by asking you to coordinate with me offline, not in the sense that you have to report to me, but in the sense that you are an active contributor to the project as am I, and at the very least we should be on the same page, and if not, take the time. I appreciate you are making plans, but if you make them in isolation, or simply assert them, surely you can understand that there are going to be crossed wires. Neither I, nor you, nor any other contributor, can put their interests on hold simply because another contributor has asserted that they are doing a certain thing. The spirit of open source software is combining effort to solve a particular problem for mutual benefit, and I'm sure you feel the same.
I have a lot of respect for any programmer taking the initiative, and especially you considering your contributions. I can genuinely understand your frustration, but please don't be skeptical. All I am asking, from a pragmatic perspective, is that we, and not just you and I, but any contributor, feel free to undertake anything they want to do, but just check in to make sure there is no redundant effort going on in terms of assembling a quality stack, and I say this against the bigger picture of open source software development, not just PureMvc.
Just to be clear, just because I completed the port (as in, I had a few hours spare the other evening and wanted to see how puremvc.define feels when used to implement a utility, but have yet to devise any comprehensive tests due to time constraints), doesn't mean I have an entitlement to 'own' the port space. None of us do! These are derivative works- the original authors deserve the kudos. Porting them is simply a pragmatic step, nothing else, at least as far as I see it. Thats my outlook, c'est fin. I hope you take the best from it, rather than the worst, and that we all can work together to get this stack right, to help us help ourselves get to the real fun stuff, which is using it to make killer apps.
Best
Dave
«
Last Edit: February 02, 2012, 04:24:12 PM by davidfoley
»
Logged
davidfoley
Moderator
Newbie
Posts: 8
Re: Native Javascript port?
«
Reply #28 on:
February 02, 2012, 04:12:14 PM »
Guys, if that isn't irony, I don't know what is- posted that not realising Cliff had posted! Ai ai ai!
Logged
Pages:
1
[
2
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Announcements and General Discussion
-----------------------------
=> General Discussion
=> Getting Started
=> Architecture
=> Public Demos, Tools and Applications
===> Fabrication
-----------------------------
PureMVC Manifold
-----------------------------
=> Port Authority
===> Contributor Central
===> Client Side
===> Server Side
=> Port to AS2
===> Standard Version
=====> Bug Report
=====> Demos and Utils
=> Port to AS3
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to ColdFusion
===> Standard Version
=====> Bug Report
=====> Demos and Utils
=> Port to C++
===> MultiCore Version
=====> Demos and Utils
=====> Bug Report
=> Port to CSharp
===> Standard Version
=====> Bug Report
=====> Demos and Utils
=> Port to Dart
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to Haxe
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to Java
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to JavaScript
===> Demos and Utils
===> Native JS Branch
=====> Bug Report
===> PrototypeJS Branch
=====> Bug Report
===> Objs Branch
=====> Bug Report
===> MooTools Branch
=====> Bug Report
===> ExtJS Branch
=====> Bug Report
=> Port to Objective C
===> Standard Version
=====> Bug Report
=====> Demos and Utils
=> Port to Perl
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to PHP
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to Python
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to Ruby
===> Standard Version
=====> Bug Report
=====> Demos and Utils
=> Port to TypeScript
===> Standard Version
=====> Bug Report
=====> Demos and Utilities
===> MultiCore Version
=====> Bug Report
=====> Demos and Utilities
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Powered by SMF 1.1.11
|
SMF © 2006-2007, Simple Machines LLC
Loading...
Copyright © 2006-2008 Futurescale, Inc.