I want to write the following line with script sharp:
App.SP = SP = Ember.Object.extend({
init: function (lineV, lineH, resourceMethod){...
Is this possible? how can I do it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In general, every script framework comes with its own variant pattern of defining classes, and script# doesn’t support all possible variants… so you can write a c# class called SP, with an Init method, and expect the EmberJS way of defining classes is the result.
What you could do is define classes for Ember.Object with an extend method that takes a dictionary, populate the dictionary with a bunch of name/value pairs, for example “init” with a value set to a delegate to a static method.
Example (this is just a start, which I am sure will require tweaking and more reworking if you continue this path):
In an import library:
And in your code:
So I think it is possible, but you’re loosing a bunch of value prop, which is to write your code like c#.
A better fit is to be able to consume existing APIs/frameworks, but write your own code as regular c# classes, that leverage the script# pattern of transforming those type constructs into script.
If there are suggestions on the pattern itself, more than welcome, esp. since there is thought on making the script# pattern considerably lighter weight going into the future.